Commit 4568cc17 authored by Jérome Perrin's avatar Jérome Perrin

budget: fix pylint messages and enable coding style

Not that the old `reversed` function was different from the builtin, we
replace it with sorted(reverse=True) to keep the same logic.
parent 468da0e3
# We don't have good implementation of budget predicate yet, so don't fill predicate table for now.
return None
# XXX strict membership is missing ?
# ideally strict membership should be an option for each category, but this API
# does not exist in predicates.
# TODO: support virtual "All other nodes"
return context.generatePredicate(
multimembership_criterion_base_category_list = ('resource',),
criterion_property_list = ('start_date', 'stop_date'))
# We don't have good implementation of budget predicate yet, so don't fill predicate table for now.
return None
context = context.asContext(
_range_criterion = {'start_date': (context.getStartDateRangeMin(),
context.getStartDateRangeMax())
})
return context
return context.generatePredicate(criterion_property_list=('start_date', 'stop_date'))
return context.generatePredicate(_range_criterion = {'start_date': (context.getStartDate(),
context.getStopDate())
})
return context.generatePredicate(criterion_property_list=('start_date',))
return context.generatePredicate(multimembership_criterion_base_category_list = ('resource',),
criterion_property_list = ('start_date',))
context = context.asContext(
criterion_property_list=['start_date'],
range_criterion = {'start_date': (context.getStartDate(),
context.getStopDate())
})
return context
......@@ -29,15 +29,10 @@ if budget_model is not None:
non_strict_base_category_set[
budget_variation.getProperty('variation_base_category')] = True
def reversed(seq):
seq = seq[::]
seq.sort(reverse=True)
return seq
# build a dict of dependant dimensions
dependant_dimensions_dict = {}
for bc in non_strict_base_category_set.keys():
vcl = reversed(context.getVariationCategoryList(base_category_list=(bc,)))
vcl = sorted(context.getVariationCategoryList(base_category_list=(bc,)), reverse=True)
for vc in vcl:
dependant_vc_list = [other_vc for other_vc in vcl
if other_vc.startswith('%s/' % vc)
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\
item_list)
item_list = [x for x in item_list if x not in (('',''), ['',''])]
sub_field_dict = {}
split_depth = 1
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</string> </value>
<value> <string>item_list, value_list, default_sub_field_property_dict=None, is_right_display=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5Type.Message import translateString
updated_cell_count = 0
dependant_dimensions_dict = context.BudgetLine_getSummaryDimensionKeyDict()
cell_key_list = context.getCellKeyList()
def reversed(seq):
seq = seq[::]
seq.sort(reverse=True)
return seq
# we iterate in reversed order to update the deepest cells first
for cell_key in reversed(cartesianProduct(context.getCellRange())):
for cell_key in sorted(cartesianProduct(context.getCellRange()), reverse=True):
for idx, dimension in enumerate(cell_key):
if dimension in dependant_dimensions_dict:
dependant_cell_list = []
......
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Remove empty items
item_list = filter(lambda x: x not in [('',''), ['','']],\
item_list)
item_list = [x for x in item_list if x not in (('',''), ['',''])]
sub_field_dict = {}
split_depth = 1
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</string> </value>
<value> <string>item_list, value_list, default_sub_field_property_dict=None, is_right_display=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -10,7 +10,7 @@ if line.getMembershipCriterionBaseCategoryList():
for variation in budget_line_category_list:
if not variation:
continue
base, category = variation.split('/', 1)
base = variation.split('/', 1)[0]
if base in line.getMembershipCriterionBaseCategoryList():
line.setMembershipCriterionCategoryList(
[variation,] + line.getMembershipCriterionCategoryList())
from Products.DCWorkflow.DCWorkflow import ValidationFailed
object = state_change['object']
error_msg = 'Please correct the following errors:'
consistency = object.checkConsistency()
for elem in consistency:
error_msg =error_msg+' '+elem[4]
if consistency != []:
raise ValidationFailed, str(error_msg)
state_change['object'].Base_checkConsistency()
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
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