Commit cc6a4003 authored by Aurel's avatar Aurel

use getattr as property maybe not defined


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11577 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d8be935
...@@ -871,7 +871,6 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -871,7 +871,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
# to get a local defined category # to get a local defined category
base_category_value = self.getCategoryValue(base_category) base_category_value = self.getCategoryValue(base_category)
#LOG("base_category_value",0,str(base_category_value))
#LOG("result",0,str(result)) #LOG("result",0,str(result))
if base_category_value is not None: if base_category_value is not None:
# If we do not mask or append, return now if not empty # If we do not mask or append, return now if not empty
...@@ -898,7 +897,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -898,7 +897,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
#if base_category_value.acquisition_mask_value: #if base_category_value.acquisition_mask_value:
# # If acquisition masks, then we must return now # # If acquisition masks, then we must return now
# return new_result # return new_result
if base_category_value.acquisition_append_value: if getattr(base_category_value, 'acquisition_append_value', False):
# If acquisition appends, then we must append to the result # If acquisition appends, then we must append to the result
result.extend(new_result) result.extend(new_result)
elif len(new_result) > 0: elif len(new_result) > 0:
...@@ -969,13 +968,13 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -969,13 +968,13 @@ class CategoryTool( UniqueObject, Folder, Base ):
else: else:
#LOG("No recursive call ",0,str((spec, my_acquisition_object.portal_type))) #LOG("No recursive call ",0,str((spec, my_acquisition_object.portal_type)))
new_result = [] new_result = []
if base_category_value.acquisition_append_value: if getattr(base_category_value, 'acquisition_append_value', False):
# If acquisition appends, then we must append to the result # If acquisition appends, then we must append to the result
result.extend(new_result) result.extend(new_result)
elif len(new_result) > 0: elif len(new_result) > 0:
#LOG("new_result ",0,str(new_result)) #LOG("new_result ",0,str(new_result))
if (base_category_value.acquisition_copy_value and len(original_result) == 0) \ if (getattr(base_category_value, 'acquisition_copy_value', False) and len(original_result) == 0) \
or base_category_value.acquisition_sync_value: or getattr(base_category_value, 'acquisition_sync_value', False):
# If copy is set and result was empty, then copy it once # If copy is set and result was empty, then copy it once
# If sync is set, then copy it again # If sync is set, then copy it again
self.setCategoryMembership( context, base_category, new_result, self.setCategoryMembership( context, base_category, new_result,
...@@ -984,7 +983,8 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -984,7 +983,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
return new_result return new_result
if (base_category_value.acquisition_copy_value or base_category_value.acquisition_sync_value)\ if (getattr(base_category_value, 'acquisition_copy_value', False) or \
getattr(base_category_value, 'acquisition_sync_value', False))\
and len(result) > 0: and len(result) > 0:
# If copy is set and result was empty, then copy it once # If copy is set and result was empty, then copy it once
# If sync is set, then copy it again # If sync is set, then copy it again
......
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