Commit e2c177a3 authored by Vincent Pelletier's avatar Vincent Pelletier

ZSQLBrain: Raise instead of returning None for unavailable objects & properties

parent 3858dcdc
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
############################################################################## ##############################################################################
import Acquisition import Acquisition
import sys
import traceback import traceback
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
...@@ -55,7 +54,6 @@ class ZSQLBrain(Acquisition.Implicit): ...@@ -55,7 +54,6 @@ class ZSQLBrain(Acquisition.Implicit):
if 'path' not in dir(self) and 'PATH' not in dir(self): if 'path' not in dir(self) and 'PATH' not in dir(self):
raise ValueError, "Unable to getObject from ZSQLBrain if ZSQL Method "\ raise ValueError, "Unable to getObject from ZSQLBrain if ZSQL Method "\
"does not retrieves the `path` column from catalog table." "does not retrieves the `path` column from catalog table."
try:
obj = self.aq_parent.unrestrictedTraverse(self.getPath()) obj = self.aq_parent.unrestrictedTraverse(self.getPath())
if obj is None: if obj is None:
if REQUEST is None: if REQUEST is None:
...@@ -63,13 +61,6 @@ class ZSQLBrain(Acquisition.Implicit): ...@@ -63,13 +61,6 @@ class ZSQLBrain(Acquisition.Implicit):
obj = self.aq_parent.portal_catalog.resolve_url( obj = self.aq_parent.portal_catalog.resolve_url(
self.getPath(), REQUEST) self.getPath(), REQUEST)
return obj return obj
except ConflictError:
raise
except:
LOG("ZCatalog WARNING", 0,
"Could not access object path %s" % self.getPath(),
error=sys.exc_info() )
return None
def getProperty(self, name, d=_MARKER, **kw): def getProperty(self, name, d=_MARKER, **kw):
value = None value = None
......
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