Commit 660ae35a authored by Vincent Pelletier's avatar Vincent Pelletier

Remove redundant code.

_aq_dynamic will be called after getattr fails.
parent 4a3ced3e
...@@ -922,32 +922,29 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -922,32 +922,29 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
Automatic related key generation. Automatic related key generation.
Will generate z_related_[base_category_id] if possible Will generate z_related_[base_category_id] if possible
""" """
aq_base_name = getattr(aq_base(self), name, None) result = None
if aq_base_name == None: if name.startswith(DYNAMIC_METHOD_NAME) and \
if (name.startswith(DYNAMIC_METHOD_NAME) and \ not name.endswith(ZOPE_SECURITY_SUFFIX):
(not name.endswith(ZOPE_SECURITY_SUFFIX))):
if name.endswith(RELATED_DYNAMIC_METHOD_NAME):
if name.endswith(RELATED_DYNAMIC_METHOD_NAME): if name.startswith(STRICT_DYNAMIC_METHOD_NAME):
if name.startswith(STRICT_DYNAMIC_METHOD_NAME): base_category_id = name[len(STRICT_DYNAMIC_METHOD_NAME):-len('_related')]
base_category_id = name[len(STRICT_DYNAMIC_METHOD_NAME):-len('_related')] method = RelatedBaseCategory(base_category_id,
method = RelatedBaseCategory(base_category_id, strict_membership=1, related=1)
strict_membership=1, related=1)
else:
base_category_id = name[len(DYNAMIC_METHOD_NAME):-len('_related')]
method = RelatedBaseCategory(base_category_id, related=1)
else: else:
if name.startswith(STRICT_DYNAMIC_METHOD_NAME): base_category_id = name[len(DYNAMIC_METHOD_NAME):-len('_related')]
base_category_id = name[len(STRICT_DYNAMIC_METHOD_NAME):] method = RelatedBaseCategory(base_category_id, related=1)
method = RelatedBaseCategory(base_category_id, strict_membership=1)
else:
base_category_id = name[len(DYNAMIC_METHOD_NAME):]
method = RelatedBaseCategory(base_category_id)
setattr(self.__class__, name, method)
return getattr(self, name)
else: else:
return aq_base_name if name.startswith(STRICT_DYNAMIC_METHOD_NAME):
return aq_base_name base_category_id = name[len(STRICT_DYNAMIC_METHOD_NAME):]
method = RelatedBaseCategory(base_category_id, strict_membership=1)
else:
base_category_id = name[len(DYNAMIC_METHOD_NAME):]
method = RelatedBaseCategory(base_category_id)
setattr(self.__class__, name, method)
result = getattr(self, name)
return result
def _searchAndActivate(self, method_id, method_args=(), method_kw={}, def _searchAndActivate(self, method_id, method_args=(), method_kw={},
activate_kw={}, min_uid=None, **kw): activate_kw={}, min_uid=None, **kw):
......
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