Timothy Grant wrote:
Hung Jung Lu wrote:
As Pavlos Christoforou said, another strategy is to
have a single session data variable (a dictionary, for instance), and then retrieve it, say, in your standard_html_header and store it in your standard_html_footer (or their equivalents.) This way you only need to access the database twice per request.
Now this in an interesting idea, but all my attempts to computationally build a dictionary within Zope have gone to naught. I would love any advice on this as I believe it could very well be the key to this problem.
To build a dict in DTML, try something like this: <dtml-var standard_html_header> <dtml-call "REQUEST.set('mydict',{})"> <dtml-call "mydict.update({'e':7})"> <dtml-with mydict mapping> [<dtml-var e>] </dtml-with> <dtml-var standard_html_footer> Plain python assignment won't work, as a "=" in python is a statement, and statements are not supported, only function calls. to remove a key, use <dtml-call "del(mydict['e'])"> ----------------- Hannu