[Zope] ZSQL direct traveral question
John Eikenberry
jae@kavi.com
Tue, 23 Mar 1999 12:50:07 -0800 (PST)
On Thu, 18 Mar 1999, John Eikenberry wrote:
> Still doesn't address my original problem thought. I still can't get
> access to any of the results of the 'mem/2' query anywhere other than
> directly after it (on the url).
>
> Ie.
>
> http://zope.kavi.com/mem/2/comp_admin/contacts/index_html
>
> Doesn't work, but...
>
> http://zope.kavi.com/mem/2/test_html
>
> Does...
>
> I'm still digging through the ZSQL code looking for a way to fix this.
> I'll let everyone know once I've figured it out.
Ok, I figured out a way to hack around this limitation of traversing an
ZSQLMethod. I whipped up a simple 'pluggable brain' for the ZSQLMethod in
question...
---------------------------------------------------
from Acquisition import Implicit
from Record import Record
class req_store_brain(Implicit):
""" stores info from sql query in REQUEST """
def __init__(self):
new = {}
for key in self.__record_schema__.keys():
new[key] = getattr(self,key)
self.aq_parent.REQUEST.other.update(new)
----------------------------------------------------
This simply sticks the results of the ZSQLMethod in the REQUEST object.
Everything in the heirarchy after this has access to the queries results.
---
John Eikenberry
[jae@kavi.com - http://taos.kavi.com/~jae/]
______________________________________________________________
"A society that will trade a little liberty for a little order
will deserve neither and lose both."
--B. Franklin