Commit b5b19a8f authored by Jean-Paul Smets's avatar Jean-Paul Smets

method_id migrated to display_id


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@446 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1d9b7f67
...@@ -120,16 +120,16 @@ class Amount(Base, Variated): ...@@ -120,16 +120,16 @@ class Amount(Base, Variated):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationRangeCategoryItemList') 'getVariationRangeCategoryItemList')
def getVariationRangeCategoryItemList(self, base_category_list = (), def getVariationRangeCategoryItemList(self, base_category_list = (),
method_id='getTitle', base=1, start_with_item=None): display_id='getTitle', base=1, current_category=None):
""" """
Returns possible category items for this amount ie. Returns possible category items for this amount ie.
the variation of the resource (not the variation range) the variation of the resource (not the variation range)
""" """
try: try:
return self.getDefaultResourceValue().getVariationCategoryItemList( return self.getDefaultResourceValue().getVariationCategoryItemList(
base_category_list, method_id=method_id, base=base, start_with_item=start_with_item) base_category_list, display_id=display_id, base=base, current_category=current_category)
except: except:
# FIXME: method_name vs. method_id, start_with_item vs. start_with_empty, etc. -yo # FIXME: method_name vs. method_id, current_category vs. start_with_empty, etc. -yo
return self.portal_categories.getCategoryChildItemList() return self.portal_categories.getCategoryChildItemList()
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
...@@ -272,7 +272,7 @@ identify a bank account.""" ...@@ -272,7 +272,7 @@ identify a bank account."""
return sorted_list return sorted_list
# Update the range of cells according to the currently selected base categories. # Update the range of cells according to the currently selected base categories.
def _updateCellRange(self, base=1, start_with_item=None): def _updateCellRange(self, base=1, current_category=None):
transformation = self.aq_parent transformation = self.aq_parent
kwd = {'base_id': 'quantity'} kwd = {'base_id': 'quantity'}
kw = [] kw = []
...@@ -358,7 +358,7 @@ identify a bank account.""" ...@@ -358,7 +358,7 @@ identify a bank account."""
# Methods for matrix UI widgets # Methods for matrix UI widgets
security.declareProtected(Permissions.AccessContentsInformation, 'getQLineItemList') security.declareProtected(Permissions.AccessContentsInformation, 'getQLineItemList')
def getQLineItemList(self, method_id='getTitle', base=1, start_with_item=None): def getQLineItemList(self, display_id='getTitle', base=1, current_category=None):
""" """
""" """
line_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[0] line_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[0]
...@@ -367,14 +367,14 @@ identify a bank account.""" ...@@ -367,14 +367,14 @@ identify a bank account."""
result = [(None,'')] result = [(None,'')]
else: else:
result = self.getVariationRangeCategoryItemList(base_category_list = [line_category], result = self.getVariationRangeCategoryItemList(base_category_list = [line_category],
method_id=method_id, display_id=display_id,
base=base, base=base,
start_with_item=start_with_item) current_category=current_category)
#LOG('getQLineItemList', 10, "%s" % str(result)) #LOG('getQLineItemList', 10, "%s" % str(result))
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getQColumnItemList') security.declareProtected(Permissions.AccessContentsInformation, 'getQColumnItemList')
def getQColumnItemList(self, method_id='getTitle', base=1, start_with_item=None): def getQColumnItemList(self, display_id='getTitle', base=1, current_category=None):
""" """
""" """
column_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[1] column_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[1]
...@@ -383,14 +383,14 @@ identify a bank account.""" ...@@ -383,14 +383,14 @@ identify a bank account."""
result = [(None,'')] result = [(None,'')]
else: else:
result = self.getVariationRangeCategoryItemList(base_category_list = [column_category], result = self.getVariationRangeCategoryItemList(base_category_list = [column_category],
method_id=method_id, display_id=display_id,
base=base, base=base,
start_with_item=start_with_item) current_category=current_category)
#LOG('getQColumnItemList', 0, "%s" % str(result)) #LOG('getQColumnItemList', 0, "%s" % str(result))
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getQTabItemList') security.declareProtected(Permissions.AccessContentsInformation, 'getQTabItemList')
def getQTabItemList(self, method_id='getTitle', base=1, start_with_item=None): def getQTabItemList(self, display_id='getTitle', base=1, current_category=None):
""" """
Returns a list of items which can be used as index for Returns a list of items which can be used as index for
each tab of a matrix or to define a cell range. each tab of a matrix or to define a cell range.
...@@ -399,15 +399,15 @@ identify a bank account.""" ...@@ -399,15 +399,15 @@ identify a bank account."""
tab_category_item_list_list = [] tab_category_item_list_list = []
for tab_category in tab_category_list: for tab_category in tab_category_list:
tab_category_item_list = self.getVariationRangeCategoryItemList(base_category_list = [tab_category], tab_category_item_list = self.getVariationRangeCategoryItemList(base_category_list = [tab_category],
method_id=method_id, display_id=display_id,
base=base, base=base,
start_with_item=start_with_item) current_category=current_category)
tab_category_item_list_list.append(tab_category_item_list) tab_category_item_list_list.append(tab_category_item_list)
transformation = self.aq_parent transformation = self.aq_parent
transformation_category_item_list = transformation.getVariationCategoryItemList( transformation_category_item_list = transformation.getVariationCategoryItemList(
method_id=method_id, method_id=method_id,
base=base, base=base,
start_with_item=start_with_item) current_category=current_category)
tab_category_item_list_list.append(transformation_category_item_list) tab_category_item_list_list.append(transformation_category_item_list)
if len(tab_category_item_list_list) > 0: if len(tab_category_item_list_list) > 0:
product_list = cartesianProduct(tab_category_item_list_list) product_list = cartesianProduct(tab_category_item_list_list)
......
...@@ -117,7 +117,7 @@ a service in a public administration).""" ...@@ -117,7 +117,7 @@ a service in a public administration)."""
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationRangeCategoryItemList') 'getVariationRangeCategoryItemList')
def getVariationRangeCategoryItemList(self, base_category_list = (), base=1, root=1, def getVariationRangeCategoryItemList(self, base_category_list = (), base=1, root=1,
method_id='getTitle', current_category=None): display_id='getTitle', current_category=None):
""" """
Returns possible variations Returns possible variations
""" """
...@@ -152,12 +152,12 @@ a service in a public administration).""" ...@@ -152,12 +152,12 @@ a service in a public administration)."""
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationCategoryItemList') 'getVariationCategoryItemList')
def getVariationCategoryItemList(self, base_category_list = (), base=1, def getVariationCategoryItemList(self, base_category_list = (), base=1,
method_id='getTitle',current_category=None): display_id='getTitle',current_category=None):
""" """
Returns possible variations Returns possible variations
""" """
result = Variated.getVariationCategoryItemList(self, base_category_list = base_category_list, result = Variated.getVariationCategoryItemList(self, base_category_list = base_category_list,
method_id=method_id, base = base, current_category=None) display_id=display_id, base = base, current_category=None)
try: try:
other_variations = self.searchFolder(portal_type = variation_type_list) other_variations = self.searchFolder(portal_type = variation_type_list)
except: except:
......
...@@ -126,9 +126,9 @@ class Variated(Interface): ...@@ -126,9 +126,9 @@ class Variated(Interface):
pass pass
def getVariationRangeCategoryItemList(self, base_category_list = (), def getVariationRangeCategoryItemList(self, base_category_list = (),
method_id='getTitle', base=1, current_category=None): display_id='getTitle', base=1, current_category=None):
""" """
returns a list of (category.id, category.method_id()) which are acceptable returns a list of (category.id, category.display_id()) which are acceptable
as discrete variation values as discrete variation values
""" """
pass pass
...@@ -141,7 +141,7 @@ class Variated(Interface): ...@@ -141,7 +141,7 @@ class Variated(Interface):
pass pass
def getVariationRangeBaseCategoryItemList(self, base_category_list = (), def getVariationRangeBaseCategoryItemList(self, base_category_list = (),
method_id='getTitle', base=1, current_category=None): display_id='getTitle', base=1, current_category=None):
""" """
returns a list of base category items which are acceptable returns a list of base category items which are acceptable
as discrete variation values as discrete variation values
......
...@@ -71,17 +71,17 @@ class Variated(Base): ...@@ -71,17 +71,17 @@ class Variated(Base):
security.declareProtected(Permissions.AccessContentsInformation, 'getVariationCategoryItemList') security.declareProtected(Permissions.AccessContentsInformation, 'getVariationCategoryItemList')
def getVariationCategoryItemList(self, base_category_list = (), base=1, def getVariationCategoryItemList(self, base_category_list = (), base=1,
method_id='getTitle', start_with_item=None): display_id='getTitle', current_category=None):
""" """
Returns the list of possible variations Returns the list of possible variations
""" """
variation_category_item_list = [] variation_category_item_list = []
if start_with_item is not None: if current_category is not None:
variation_category_item_list.append(start_with_item) variation_category_item_list.append((current_category,current_category))
variation_category_list = self.getVariationCategoryList(base_category_list=base_category_list) variation_category_list = self.getVariationCategoryList(base_category_list=base_category_list)
for variation_category in variation_category_list: for variation_category in variation_category_list:
resource = self.portal_categories.resolveCategory(variation_category) resource = self.portal_categories.resolveCategory(variation_category)
value = getattr(resource, method_id)() value = getattr(resource, display_id)()
if base: if base:
label = variation_category label = variation_category
else: else:
...@@ -129,7 +129,7 @@ class Variated(Base): ...@@ -129,7 +129,7 @@ class Variated(Base):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationRangeBaseCategoryItemList') 'getVariationRangeBaseCategoryItemList')
def getVariationRangeBaseCategoryItemList(self, base=1, method_id='getTitle', start_with_item=None): def getVariationRangeBaseCategoryItemList(self, base=1, display_id='getTitle', current_category=None):
""" """
Returns possible variations of the resource Returns possible variations of the resource
as a list of tuples (id, title). This is mostly as a list of tuples (id, title). This is mostly
......
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