Re: [Zope3-Users] New Request Variable?

2006-05-19 Thread Jean-Marc Orliaguet

Jim Washington wrote:
I have an expensive function (the result is a long list of IntIds) 
that I only want to call once in a request.  It only gets calculated 
the first time it is called, and the results may be used anytime after 
that.  But only for the current request.  A subsequent request has to 
recalculate from the beginning.


Session is the wrong place to stash this.  I do not want want it to 
persist beyond the current request.


Request is also the wrong place.  It's slotted; I cannot add variables.

So where is the proper place to hold on to something like this just 
for the duration of one request?


Suggestions (or solutions), anyone?  I fear I may have missed 
something obvious.


-Jim Washington


Hi, use request annotations, they're writable:

self.request.annotations['namespace.var'] = var
self.request.annotations.get('namespace.var')

/JM
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] New Request Variable?

2006-05-19 Thread Jim Washington

Fred Drake wrote:

On 5/19/06, Jim Washington <[EMAIL PROTECTED]> wrote:

Request is also the wrong place.  It's slotted; I cannot add variables.


Isn't this what the request annotations are for?


 -Fred

Thanks, Fred.  That is, of course, the correct (and quite elegant) 
solution. 


-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] New Request Variable?

2006-05-19 Thread Fred Drake

On 5/19/06, Jim Washington <[EMAIL PROTECTED]> wrote:

Request is also the wrong place.  It's slotted; I cannot add variables.


Isn't this what the request annotations are for?


 -Fred

--
Fred L. Drake, Jr.
"Education is hanging around until you've caught on." -- Robert Frost
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users