Commit a6fe8eb7 authored by Jérome Perrin's avatar Jérome Perrin

project: fix pylint messages

parent 5439dc02
......@@ -4,12 +4,12 @@ now = DateTime()
domain_list = []
parents_criterion_dict = {}
def appendNewTempDomain(id, criterion_dict=None, **kw):
def appendNewTempDomain(id_, criterion_dict=None, **kw):
if criterion_dict is None:
criterion_dict = parents_criterion_dict
else:
criterion_dict.update(parents_criterion_dict)
domain = parent.generateTempDomain(id=id)
domain = parent.generateTempDomain(id=id_)
domain.edit(
criterion_property_list=criterion_dict.keys(),
**kw
......@@ -19,12 +19,12 @@ def appendNewTempDomain(id, criterion_dict=None, **kw):
domain_list.append(domain)
appendNewTempDomain(
id="future",
id_="future",
title="Future",
criterion_dict={criterion_property: {"min": now, "max": DateTime('9999/01/01 00:00')}},
)
appendNewTempDomain(
id="past",
id_="past",
title="Past",
criterion_dict={criterion_property: {"min": DateTime('1000/01/01 00:00'), "max": now}},
)
......
......@@ -42,8 +42,8 @@ task_items.sort(key=lambda x: x['id'])
for item in task_items:
if item['title'] != '':
task = task_module.newContent( portal_type = document_type
if item['title'] != '':
task = task_module.newContent( portal_type = document_type
, title = item['title']
, reference = item['reference']
, description = item['description']
......@@ -59,15 +59,15 @@ for item in task_items:
, destination = item['destination']
)
if item['reference'] == '':
task.setReference('T-' + str(task.getId()))
if item['reference'] == '':
task.setReference('T-' + str(task.getId()))
if item['requirement'] is not None:
if isinstance(item['requirement'],str):
task.setTaskLineRequirement(item['requirement'])
else:
task.setTaskLineRequirementList(item['requirement'])
task.setSourceProjectValue(context_obj)
if item['requirement'] is not None:
if isinstance(item['requirement'],str):
task.setTaskLineRequirement(item['requirement'])
else:
task.setTaskLineRequirementList(item['requirement'])
task.setSourceProjectValue(context_obj)
# return to the project
return context.Base_redirect('view', keep_items={'portal_status_message': 'Tasks added at Task Module.'})
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>source, source_section, destination_decision, destination_section, destination, task_line_quantity_unit, resource, listbox=[],**kw</string> </value>
<value> <string>source, source_section, destination_decision, destination_section, destination, task_line_quantity_unit, resource, listbox=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -3,7 +3,7 @@ requeriment_list_value = context.getRequirementValueList()
requeriment_string_list = []
for req in requeriment_list_value:
resource_path = '/'.join(req.getPath().split('/')[2:])
requeriment_string_list.append([req.getTitle(), resource_path ])
resource_path = '/'.join(req.getPath().split('/')[2:])
requeriment_string_list.append([req.getTitle(), resource_path ])
return requeriment_string_list
......@@ -12,7 +12,6 @@ def getWorkLineList(line,worker):
result.append(line)
return result
listbox = []
worker_list = context.getParentValue().getSourceValueList()
work_line_list = []
for worker in worker_list:
......
......@@ -27,9 +27,9 @@ portal_catalog = portal.portal_catalog
# hasColumn exists, it is new and is not installed yet everywhere
hasColumn = getattr(portal_catalog, 'hasColumn', None)
if hasColumn is not None:
for property in ['outcome_description']:
if hasColumn(property):
select_dict[property] = None
for prop in ['outcome_description']:
if hasColumn(prop):
select_dict[prop] = None
if len(project_uid_list):
milestone_list = [x for x in portal.portal_catalog(parent_uid=project_uid_list,
......
......@@ -5,21 +5,15 @@ project_line_portal_type = 'Project Line'
domain_list = []
here = context.REQUEST['here']
portal = context.getPortalObject()
form_id=request.get('form_id')
selection_name = request.get('selection_name')
params = portal.portal_selections.getSelectionParamsFor(selection_name, request)
object_path = request.get('object_path')
if object_path is None:
object_path = context.REQUEST.get('URL1').split('/')[-1]
search_path = 'project_module/%s/%%' % object_path
category_list = []
if depth == 0:
# Get start date and stop date from document
from_date = request.get('from_date')
at_date = request.get('at_date')
current_month = None
# We must initialize from_date at the beginning of the month
current_date = from_date
is_total = here.is_total
......@@ -56,10 +50,7 @@ if depth == 0:
#i += 1
else:
object_dict = here.object_dict
string_index = getattr(parent, 'string_index')
object_sub_dict = object_dict.get(string_index, {})
object_url_dict = {}
project_to_display_dict = here.monthly_project_to_display_dict.get(string_index, {})
if depth == 1:
category_list = [here.project_dict[x] for x in project_to_display_dict.keys() if
......@@ -70,19 +61,15 @@ else:
# Very specific to the monthly report, if no data, we do not display the current tree part
# sor first, for performance, build a dict with all relative urls of project line that will
# need to be displayed for this month
object_dict = here.object_dict
object_sub_dict = object_dict.get(getattr(parent, 'string_index'), {})
object_url_dict = {}
for parent_category in parent_category_list:
parent_category = '/'.join(parent_category.split('/')[1:])
if project_to_display_dict.has_key(parent_category):
parent_category_object = context.restrictedTraverse(parent_category)
category_child_list = parent_category_object.contentValues(portal_type=project_line_portal_type)
#category_list.append(parent_category_object)
for category_child in category_child_list:
if project_to_display_dict.has_key(category_child.getRelativeUrl()):
category_list.append(category_child)
parent_category_object = context.restrictedTraverse(parent_category)
category_child_list = parent_category_object.contentValues(portal_type=project_line_portal_type)
#category_list.append(parent_category_object)
for category_child in category_child_list:
if project_to_display_dict.has_key(category_child.getRelativeUrl()):
category_list.append(category_child)
i = 0
......
request = context.REQUEST
project_line_portal_type = 'Project Line'
domain_list = []
......
......@@ -9,7 +9,7 @@ search_path = 'project_module/%s/%%'
if depth == 0:
category_list = []
for line in context.portal_catalog(path=search_path ):
category_list.extend([ i for i in line.getObject().getSourceProjectRelatedValueList() if i not in category_list])
category_list.extend([ i for i in line.getObject().getSourceProjectRelatedValueList() if i not in category_list])
else:
return domain_list
......
from Products.ZSQLCatalog.SQLCatalog import Query
request = context.REQUEST
object_dict = {} # it contains required temp object to display the listbox
......@@ -111,8 +110,6 @@ for task_line in result_list:
source_relative_url = source_dict['relative_url']
start_date_task = task_line.date
stop_date_task = task_line.mirror_date
year_start_date = start_date_task.year()
month_start_date = start_date_task.month()
# create a list with people who works on the task
current_column = (source_relative_url, source_title)
......@@ -197,7 +194,6 @@ portal.portal_selections.setListboxDisplayMode(request, 'ReportTreeMode',
result = []
from Products.ERP5Form.Report import ReportSection
param_dict = {}
project_dict = {}
for project_relative_url in project_relative_url_dict.keys():
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None, selection_report=None, portal_type=[], **kw</string> </value>
<value> <string>selection=None, selection_report=None, portal_type=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -4,8 +4,6 @@ result = []
params = {}
portal = context.portal_url.getPortalObject()
for project_line in [x.getObject() for x in context.searchFolder(sort_id='int_index')]:
result.append(
......
from Products.ERP5Type.Document import newTempBase
from string import zfill
global portal_object, new_id, l
portal_object = context.getPortalObject()
if lines_num is None:
......@@ -13,9 +11,7 @@ l = []
# function to create a new fast input line
def createInputLine():
global portal_object, new_id, l
new_id += 1
def createInputLine(new_id):
int_len = 3
o = newTempBase( portal_object,
str(new_id),
......@@ -24,8 +20,8 @@ def createInputLine():
l.append(o)
# generate all lines for the fast input form
for x in range(lines_num):
createInputLine()
for new_id in range(lines_num):
createInputLine(new_id + 1)
# return the list of fast input lines
return l
result = []
def getContentValues(item, parent_id):
cv_list = item.contentValues()
for cv in cv_list:
custom_id = "%s-%s"%(parent_id, cv.id)
result.append((cv,custom_id))
getContentValues(cv, custom_id )
cv_list = item.contentValues()
for cv in cv_list:
custom_id = "%s-%s"%(parent_id, cv.id)
result.append((cv,custom_id))
getContentValues(cv, custom_id )
getContentValues(context, str(context.id) )
......
......@@ -3,9 +3,8 @@ This script is called to generate references for all requirements
"""
translateString = context.Base_translateString
request = context.REQUEST
current_type = context.getPortalType()
if not reference: reference='R'
if not reference:
reference='R'
def generateReference(prefix, order, portal_type):
for order_line in order.contentValues(portal_type=portal_type, checked_permission='View', sort_on='int_index'):
......
......@@ -95,7 +95,7 @@ for key in clean_requirements_key_list:
sub_requirement_int_index = 0
for second_level in clean_requirements[key]:
sub_requirement_int_index += 10
new_2nd_requirement = new_1st_requirement.newContent( portal_type = requirement_type
new_1st_requirement.newContent( portal_type = requirement_type
, title = second_level['title']
, description = second_level['description']
, int_index = sub_requirement_int_index
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], form_id=\'view\', **kw</string> </value>
<value> <string>listbox=(), form_id=\'view\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
request = context.REQUEST
domain_list = []
if depth == 0:
module = context.task_module
......
from Products.ERP5Type.DateUtils import addToDate
Base_translateString = context.Base_translateString
task_portal_type = 'Task'
task_module = context.getDefaultModule(task_portal_type)
def validateDay(date):
if (periodicity_month_day_list in ([], None, ())):
......@@ -30,7 +28,6 @@ def validateMonth(date):
def getNextPeriodicalDate(current_date):
next_start_date = current_date
previous_date = next_start_date
next_start_date = addToDate(next_start_date, day=1)
while 1:
if (validateDay(next_start_date)) and \
......
......@@ -35,7 +35,6 @@ project_search_dict = {}
portal = context.getPortalObject()
for line in line_list:
line_dict = {}
line_id = "%s" % line.getUid()
#line_dict['listbox_key'] = "%s" % line_id
key = zfill(i,3)
for property_name in ('title', 'quantity_unit_title', 'quantity',
......@@ -83,7 +82,7 @@ if len(validation_errors):
if create and len(validation_errors) == 0:
for line in listbox:
delivery_line = portal.restrictedTraverse(line['relative_url'])
task = portal.task_module.newContent(
portal.task_module.newContent(
title=delivery_line.getTitle(),
source_project=line['source_project_relative_url'],
source=delivery_line.getSourceTrade(),
......
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
object = state_change['object']
object.Base_checkConsistency()
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