[Twisted-Python] model question

vicky lupien vlupien at drummonddesigns.com
Mon Nov 17 14:44:36 EST 2003

I have a web based application.
I want to create a model from a sql query that will be accessible from
the web page.
I want to be able to create my model in the setUp fonction.
I also want to access my model from the web page like this:
model="plan_id" (where plan_id is a column from my sql query)
I don't know if someone understand what I want.
Here's a part of my class:
class SummaryDB:
    """PublisherDB Class"""
    def __init__(self, dbpool):
        self.dbpool = dbpool
    def getSummary(self, plan_id):
        sql = "select * from plan where plan_id = '%s'" %plan_id
        return self.dbpool.runQueryDict(sql)
class SummaryPage(pages.BasePage):
    templateFile = "summary.html"
    def initialize(self, dbpool):
        self.dbpool = dbpool
        self.db = SummaryDB(self.dbpool)
    def setUp(self, request, *args):
        # I want to do somethings like :
        # self.model = ({'details' : self.db.getSummary(plan_id)}
        # and then, access to details by my web page
        self.contextMenu = menus.build_search_menu()
And here's my template:
                        <br />
                        <table border="0" width="100%" cellspacing="1"
                                                <th class="header"
                                                <td class="label"
                                                <td class="area"
width="75%" model="details/plan_id">&nbsp;2165</td>    #plan_id is a
column from the sql query
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20031117/dff4b20a/attachment.htm 

More information about the Twisted-Python mailing list