[Twisted-Python] model question

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: <html> <head> <title> Title </title> </head> <body> <br /> <table border="0" width="100%" cellspacing="1" cellpadding="2"> <tr> <th class="header" colspan="2"> Sommaire </th> </tr> <tr> <td class="label" width="25%"> Number </td> <td class="area" width="75%" model="details/plan_id"> 2165</td> #plan_id is a column from the sql query </tr> </table> </body> </html>

On Monday 17 November 2003 20:44, vicky lupien wrote:
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.
Why don't you use a wmfactory_details ? I don't understand why you want to put it in the setUp method :(
participants (2)
-
Philippe Lafoucrière
-
vicky lupien