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

Reply via email to