From 26e598cfad2375a11ec1ea43b8588d5b230125ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 10 Mar 2006 10:45:59 +0000 Subject: [PATCH] Prevent infinite loop in _aq_dynamic if path is not retrieved from database git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6069 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/zsqlbrain.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/product/ZSQLCatalog/zsqlbrain.py b/product/ZSQLCatalog/zsqlbrain.py index 8bcad895a5..8df9d1817d 100755 --- a/product/ZSQLCatalog/zsqlbrain.py +++ b/product/ZSQLCatalog/zsqlbrain.py @@ -26,9 +26,17 @@ class ZSQLBrain(Acquisition.Implicit): security = ClassSecurityInfo() security.declareObjectPublic() + def __init__(self) : + """Init the brain and make sure path was retrieved from the RDB""" + if 'path' not in dir(self) and 'PATH' not in dir(self): + raise ValueError, "Unable to use ZSQLBrain if ZSQL Method does "\ + "not retrieves the `path` column from catalog table." + def _aq_dynamic(self, name): """Acquire an attribute from a real object. """ + if name.startswith('__') : + return None o = self.getObject() return getattr(o, name, None) -- 2.30.9