[Zope] ZCatalog + Virtual Hosting = Trouble
Edmund Goppelt
goppelt@goppelt.net
Thu, 8 Feb 2001 13:23:24 -0500
It seems a well established fact that ZCatalog does not work properly
with virtual hosting. I've tried Evan Simpson's ZCatalog patch, but
to no avail:
***DOES NOT WORK
def resolve_url(self, path, REQUEST):
"""
Attempt to resolve a url into an object in the Zope
namespace. The url may be absolute (site-relative) or a catalog path
style url. If no object is found, None is returned.
No exceptions are raised.
"""
pparts = filter(None, string.split(path, '/'))
try:
obj = getattr(self.aq_parent, pparts.pop(0))
while pparts:
obj = obj[pparts.pop(0)]
return obj
except:
return
The following *does* seem to work. Can someone tell me why? Are
there any nasty side effects I should know about, or is this a good
way of getting ZCatalog to play nice with Virtual Hosting?
***WORKS
def resolve_url(self, path, REQUEST):
"""
Attempt to resolve a url into an object in the Zope
namespace. The url may be absolute or a catalog path
style url. If no object is found, None is returned.
No exceptions are raised.
"""
pparts=filter(None, string.split(path, '/'))
try:
obj=getattr(self.aq_parent, pparts.pop(0))
while pparts:
obj=getattr(obj, pparts.pop(0))
return obj
except:
return
--
Ed Goppelt