[Zope] Product AttributeError __error_log__ ???

chrisf chrisf@fagmed.uit.no
Wed, 04 Dec 2002 12:40:51 +0100


"Stefan H. Holek" wrote:

>
> No, but you must make sure the app object can be acquired.
>
> Line 134 of module Zope is:
>
> log = aq_acquire(published, '__error_log__', containment=1)
>
> Either you have to _setObject() you object or wrap it manually.

I noticed the code as well, too bad. I DON'T want to inherit from aquire.
This should not be a requirement for basic functionality, such as error
checking  !!!
Have we forgotten good OO design paradigms ???
My classes are numerous, some are generated on the fly,  and none are
registered as products.
Each class exists in a hash under of the one registered product 'Family
Dispatcher' that intercepts the http request, splits it, and
recusively searches through the children hash of objects for
attributes(methods), or returns error.
Each class does inherit from persistence of course.


If interested the code is quite small:

 def __bobo_traverse__(self,REQUEST=None,NAME=None): return self

 def __call__(self,REQUEST):
          url = REQUEST.URLPATH0.split('/')
          url = url[url.index(self.id)+1:]
          if 'white' in url: url.remove('white') # a wierd zope thing
          return self.__find__(url,obj=None,REQUEST=REQUEST)

 def __find__(self,url,obj=None,REQUEST=None):
          if obj is None: obj=self
          i = url[0]
          if hasattr(obj, i)   : return getattr(obj,i)(REQUEST)
          if obj.children.has_key(i): return
self.__find__(url=url[1:],obj=obj.children[i],REQUEST=REQUEST)
          else                      :     return 'error'