Hello, Zope community. I use Zope 2.7.3, Python 2.3.4 and Plone 2.0.5 I have a strange behavior of template. It displays OK when accessing via IP address, but when I try to access it via name I get assertion error. Template uses the script that contains assertion: ... if brain.Title != '': obj = brain.getObject() # here it is assert(obj) type = obj.getAdvert_type() hereTitle = brain.Title ... As you can guess, variable "brain" contains brain from catalog. So, when I access the template, using this script via name it raises Assertion Error. Seems like it can't get object from catalog. But it works with IP... Please advise what is my problem. Thank you. -- Best regards, Denis Mishunoff mailto:spliter@sdtcom.lg.ua http://plonetarium.objectis.net
Denis Mishunoff wrote at 2005-5-13 11:21 +0300:
I use Zope 2.7.3, Python 2.3.4 and Plone 2.0.5 I have a strange behavior of template. It displays OK when accessing via IP address, but when I try to access it via name I get assertion error. Template uses the script that contains assertion:
...
if brain.Title != '': obj = brain.getObject() # here it is assert(obj)
Looks as if your catalog were very old and still has entries with request relative resolution. Replace "assert(obj)" with if not obj: # here the assert would fail # determine its path for later analysis path = brain.getPath() # ensure, you can see "path" somehow else: # here the assert would pass ... With this information, you can try to analyse the problem in an interactive Python interpreter. -- Dieter
Hello, Dieter. You wrote 13 мая 2005 г., 22:21:49:
Looks as if your catalog were very old and still has entries with request relative resolution.
Replace "assert(obj)" with
if not obj: # here the assert would fail # determine its path for later analysis path = brain.getPath() # ensure, you can see "path" somehow else: # here the assert would pass ...
With this information, you can try to analyse the problem in an interactive Python interpreter.
Thanks, Dieter. I tried your advice and made the following code: if not obj: # here the assert would fail # determine its path for later analysis path = brain.getPath() tagencies.append(path) else: # here the assert would pass ... To have either object or brain's path in output ("tagencies" list). The most interesting is that accessing via name I've got objects and paths, but accessing via IP I've got ONLY object - no paths... Then I checked the paths I got for presence of objects on them. Objects are there, so I decided to use tagencies.append(portal.restrictedTraverse(path)) in code (portal variable was defined), but got the "sign in" screen :( Maybe it's because I have not so usual structure of Instance? I have ZOPE-ROOT - Folder1 - Plone site I'm totally confused and don't know what to do with all this. Please advise. -- Best regards, Denis Mishunoff mailto:spliter@sdtcom.lg.ua http://plonetarium.objectis.net
[Dieter]
Looks as if your catalog were very old and still has entries with request relative resolution. ... With this information, you can try to analyse the problem in an interactive Python interpreter.
...
[Denis] To have either object or brain's path in output ("tagencies" list). The most interesting is that accessing via name I've got objects and paths [Dieter] this means that some paths could not be resolved (you get them as paths and cannot get objects). They probably form the "old" content still using request relative access. [Denis] but accessing via IP I've got ONLY object - no paths... [Dieter] In this case, all paths can be resolved into objects. You should select one or two failing paths and analyse them (this is done best in an interactive interpreter; under *nix, such an interpreter can be started with "bin/zopectl debug"). [Denis] Then I checked the paths I got for presence of objects on them. Objects are there, so I decided to use tagencies.append(portal.restrictedTraverse(path)) [Dieter] Try "unrestrictedTraverse" (will not work in untrusted code -- use the interactive interpreter). If "unrestrictedTraverse" can resolve the path, this means that the problem is a permission problem: the user is not allowed to access some object of "path". The catalog tries two ways to resolve a path: the modern one uses "physical path" related traversal, the old one uses request relative Url traversal. Due to a bug introduced in a recent Zope version (and I think fixed again in Zope 2.7.6), the modern approach performs too strict access controls. This may mean that the request relative Url traversal is used as a fallback. The request relative Url traversal is known to have severe problems with virtual hosting (also it is not yet known why host specification via name or IP should make a difference). I (at your place) would debug "brain.getObject()" for one of the failing brains. Please search the mailing list archives for some notes about debugging Plone/Zope. http://plonetarium.objectis.net -- Dieter
Hello, Dieter.
I (at your place) would debug "brain.getObject()" for one of the failing brains.
Please search the mailing list archives for some notes about debugging Plone/Zope. http://plonetarium.objectis.net
Thanks in advance, Dieter. Will try your advises. -- Best regards, Denis Mishunoff mailto:spliter@sdtcom.lg.ua http://plonetarium.objectis.net
participants (2)
-
Denis Mishunoff -
Dieter Maurer