Commit d05c9d7d authored by Sebastien Robin's avatar Sebastien Robin

disable the guessed_base_category check


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2818 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 559e30ed
...@@ -141,23 +141,23 @@ class Renderer(Filter): ...@@ -141,23 +141,23 @@ class Renderer(Filter):
# If base=1 but base_category is None, it is necessary to guess the base category # If base=1 but base_category is None, it is necessary to guess the base category
# by heuristic. # by heuristic.
if self.base and self.base_category is None: # if self.base and self.base_category is None:
base_category_count_map = {} # base_category_count_map = {}
for value in value_list: # for value in value_list:
if not getattr(value, 'isCategory', 0): # if not getattr(value, 'isCategory', 0):
continue # continue
b = value.getBaseCategoryId() # b = value.getBaseCategoryId()
if b in base_category_count_map: # if b in base_category_count_map:
base_category_count_map[b] += 1 # base_category_count_map[b] += 1
else: # else:
base_category_count_map[b] = 1 # base_category_count_map[b] = 1
guessed_base_category = None # guessed_base_category = None
max_count = 0 # max_count = 0
for k,v in base_category_count_map.items(): # for k,v in base_category_count_map.items():
if v > max_count: # if v > max_count:
guessed_base_category = k # guessed_base_category = k
max_count = v # max_count = v
LOG('render', 100, repr(guessed_base_category)) # LOG('render', 100, repr(guessed_base_category))
# Initialize the list of items. # Initialize the list of items.
item_list = [] item_list = []
...@@ -199,10 +199,13 @@ class Renderer(Filter): ...@@ -199,10 +199,13 @@ class Renderer(Filter):
else: else:
# If the base category of this category does not match the guessed base category, # If the base category of this category does not match the guessed base category,
# merely ignore this category. # merely ignore this category.
# This is not the job for a Renderer to automatically remove values if we don not
# specify a filter
if not hasattr(value, 'getBaseCategoryId'): if not hasattr(value, 'getBaseCategoryId'):
continue continue
if value.getBaseCategoryId() != guessed_base_category: # Remove from now, it might be outdated and useless
continue #if value.getBaseCategoryId() != guessed_base_category:
# continue
else: else:
if self.base_category: if self.base_category:
# Nothing to do. # Nothing to do.
......
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