Commit b9ca9311 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: use valid API.

Add some comments.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3783 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5f020c70
......@@ -52,10 +52,10 @@ class CategoryExistence(Constraint):
# Check existence of base category
error_message = "Category existence error for base category '%s': " % \
base_category
if not object.hasCategory(base_category):
if base_category not in object.getBaseCategoryList():
error_message += " this document has no such category"
elif object.getProperty(base_category) is None:
error_message += " this property was not defined"
elif len(object.getCategoryMembershipList(base_category)) == 0:
error_message += " this category was not defined"
else:
error_message = None
# Raise error
......
......@@ -57,6 +57,8 @@ class PropertyExistence(Constraint):
if not object.hasProperty(property_id):
error_message += " this document has no such property"
elif object.getProperty(property_id) is None:
# If value is '', attribute is considered a defined
# XXX is this the default API ?
error_message += " this property was not defined"
else:
error_message = 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