Commit 11202038 authored by Romain Courteaud's avatar Romain Courteaud

Changed code layout.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5024 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f33a948a
...@@ -415,10 +415,13 @@ class Category(Folder): ...@@ -415,10 +415,13 @@ class Category(Folder):
#LOG('asSqlExpression', 0, str(self)) #LOG('asSqlExpression', 0, str(self))
#LOG('asSqlExpression parent', 0, str(self.aq_parent)) #LOG('asSqlExpression parent', 0, str(self.aq_parent))
if strict_membership: if strict_membership:
sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s AND %s.category_strict_membership = 1)' % (table, self.getUid(), table, self.getBaseCategoryUid(), table) sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s ' \
'AND %s.category_strict_membership = 1)' % \
(table, self.getUid(), table,
self.getBaseCategoryUid(), table)
else: else:
sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s)' % (table, self.getUid(), sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s)' % \
table, self.getBaseCategoryUid()) (table, self.getUid(), table, self.getBaseCategoryUid())
# Now useless since we precompute the mapping # Now useless since we precompute the mapping
#for o in self.objectValues(): #for o in self.objectValues():
# sql_text += ' OR %s' % o.asSqlExpression() # sql_text += ' OR %s' % o.asSqlExpression()
...@@ -542,15 +545,19 @@ class BaseCategory(Category): ...@@ -542,15 +545,19 @@ class BaseCategory(Category):
ZSQLCatalog ZSQLCatalog
""" """
if strict_membership: if strict_membership:
sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s AND %s.category_strict_membership = 1)' % (table, self.uid, table, self.uid, table) sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s ' \
'AND %s.category_strict_membership = 1)' % \
(table, self.uid, table, self.uid, table)
else: else:
sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s)' % (table, self.uid, table, self.uid) sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s)' % \
(table, self.uid, table, self.uid)
# Now useless since we precompute the mapping # Now useless since we precompute the mapping
#for o in self.objectValues(): #for o in self.objectValues():
# sql_text += ' OR %s' % o.asSqlExpression() # sql_text += ' OR %s' % o.asSqlExpression()
return sql_text return sql_text
security.declareProtected( Permissions.AccessContentsInformation, 'getBaseCategoryId' ) security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategoryId')
def getBaseCategoryId(self): def getBaseCategoryId(self):
""" """
The base category of this object The base category of this object
...@@ -559,7 +566,8 @@ class BaseCategory(Category): ...@@ -559,7 +566,8 @@ class BaseCategory(Category):
""" """
return self.getBaseCategory().id return self.getBaseCategory().id
security.declareProtected( Permissions.AccessContentsInformation, 'getBaseCategoryUid' ) security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategoryUid')
def getBaseCategoryUid(self): def getBaseCategoryUid(self):
""" """
The base category uid of this object The base category uid of this object
...@@ -568,7 +576,8 @@ class BaseCategory(Category): ...@@ -568,7 +576,8 @@ class BaseCategory(Category):
""" """
return self.getBaseCategory().getUid() return self.getBaseCategory().getUid()
security.declareProtected( Permissions.AccessContentsInformation, 'getBaseCategoryValue' ) security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategoryValue')
def getBaseCategoryValue(self): def getBaseCategoryValue(self):
""" """
The base category of this object The base category of this object
...@@ -612,7 +621,8 @@ class BaseCategory(Category): ...@@ -612,7 +621,8 @@ class BaseCategory(Category):
return sortValueList(value_list, sort_on, sort_order, **kw) return sortValueList(value_list, sort_on, sort_order, **kw)
# Alias for compatibility # Alias for compatibility
security.declareProtected( Permissions.AccessContentsInformation, 'getBaseCategory' ) security.declareProtected(Permissions.AccessContentsInformation,
'getBaseCategory')
getBaseCategory = getBaseCategoryValue getBaseCategory = getBaseCategoryValue
InitializeClass( Category ) InitializeClass( Category )
......
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