[Zope] zpt and sql

Andrew Milton akm at theinternet.com.au
Fri Jul 22 12:00:36 EDT 2005


+-------[ Nicholas Wieland ]----------------------
| Hi *, I've searched a lot but actually didn't find anything useful to solve my
| problem, and probably I haven't really understood how Zope works ... :)
| I'm developing a filesystem product and I need to display a zpt form where I
| display some results from a query.
| I'm able to query the DB, and I'm able to display an empty zpt form, qhat I
| don't understand is how to stick the two things together.
|  
| This is what I have:
|  
| class InstitutionalReport (Item, Implicit, Persistent, RoleManager, Folder):
|   """ Base class for InstitutionalReport. """
|   meta_type = "Institutional Report"
|   manage_options = (
|     {'label' : 'View', 'action' : 'index_html' },
|   )
|   def __init__ (self, id, conn_id):
|     """ initializer """
|     self.id = id
|     self.conn_id = conn_id
|     self.sqlGetReferenceDate = SQL ('slGetReferenceDate', '', conn_id, '',
| _sqlGetReferenceDate)
|     #Folder.manage_addPageTemplate (self, 'index_html', file =
| self.def_index_html, REQUEST = None)
|   index_html = PageTemplateFile ("zpt/index_html.pt", globals ())

| I want to cycle through the query result with ZPT and populate a select.

<select ..>
	<option tal:repeat="obj here/sqlGetReferenceDate"
	tal:attributes="value obj/somefield" tal:content="here/someOtherField">Value</option>
</select>


-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list