[Zope3-Users] Access to request in content object and object path
in doctests
Maciej Wisniowski
maciej.wisniowski at coig.katowice.pl
Wed Jan 24 17:50:21 EST 2007
Hi
Two questions...
Is this possible to get
request object in content class. In Zope2 this
was possible with simple self.REQUEST. In Zope3
I tried self.request but I only get errors.
Maybe this is a feature, and I'm not supposed
to access request object from content class?
Another question. I'm trying to write tests
for my content object.
Because I want some caching facilities
I'm using getLocationForCache from
zope.app.cache.caching.
and because of this: zapi.getPath(obj)
In short it is like:
class MyClass(Persistent):
(...)
def myfunction(self):
location = zapi.getPath(self)
return location
In the tests I always get location == None.
I'm using doctests like:
>>> test_content = MyClass()
>>> test_content.myfunction()
placefulsetup adds some objects like root etc.
but I'm not sure how I should add my object to this.
Any clues?
--
Maciej Wisniowski
More information about the Zope3-users
mailing list