Commit ea166539 authored by 's avatar

Made a better fix to the resolve_url/transaction abort problem, to avoid

duplicated code. The resolve_url of the REQUEST now correctly avoids aborting
the current transaction if an error occurs, so we just use that.
parent 9d2429a0
......@@ -430,58 +430,19 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
return roles
# NOTE - DO NOT CHANGE THIS! The semantics required for url
# resolution are _different_ for the catalog (and probably
# DAV as well), and this needs to remain until we can think
# harder about the resolve_url interface!
def resolve_url(self, path, REQUEST):
""" """
while path and path[0]=='/': path=path[1:]
while path and path[-1]=='/': path=path[:-1]
req=REQUEST.clone()
rsp=req.response
req['PATH_INFO']=path
object=None
try: object=req.traverse(path)
except:
# Do NOT call rsp.exception here!
pass
if object is not None:
if hasattr(object, 'id'):
if callable(object.id):
name=object.id()
else: name=object.id
elif hasattr(object, '__name__'):
name=object.__name__
else: name=''
if name != os.path.split(path)[-1]:
result = req.PARENTS[0]
req.close()
return result
req.close()
return object
req.close()
raise rsp.errmsg, sys.exc_value
## 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.
## """
## script=REQUEST.script
## if string.find(path, script) != 0:
## path='%s/%s' % (script, path)
## print "resolving", path
## try:
## return REQUEST.resolve_url(path)
## except:
## print "not found"
## return None
"""
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.
"""
script=REQUEST.script
if string.find(path, script) != 0:
path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path)
except: return None
Globals.default__class_init__(ZCatalog)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment