[Zope-DB] Adding presentation metadata to an SQL Method

Charlie Clark charlie@begeistert.org
Mon, 14 Apr 2003 10:51:48 +0200


On 2003-04-14 at 09:30:21 [+0200], Kevin Chambers wrote:
> Hi there--
> 
> I don't know that this is the right place to ask this, but I'm new to 
> Zope, and looking for ideas about how to get to where I need to go...
> 
> I would like to be able to extend an SQL Method so as to be able to add 
> presentation data about each field so that I could do iterate through a 
> collection of field objects and have each one produce the right 
> formattingin HTML.  For example, specifying a css class or appropriate 
> input type.
> 
> I don't know if this is right way to go about this in Zope.  I'm just 
> trying figuring out what the best "zope ways" are of flexibly adding 
> presentation metadata to the data I'm pulling out of my DB.
> 
> And if there's a better place to ask a question like this, please let me 
> know.

Hi Kevin,

you definitely don't want to add presentation information to SQL calls and 
it's pretty much impossible with SQL-methods which contain by and large 
plain SQL.

You can write a PythonScript or an ExternalMethod to do what you want but I 
can't see a good reason for it. You'd then have to "render" these scripts 
specially in your PageTemplates. It is much better in my opinion to do your 
presentation in your ZPT where you and others have full control over it. 
You can still make presentation dependent on the type of data you receive.

Charlie