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

xhtml_style: fix pylint errors and enable coding style

parent ffa46bfd
......@@ -128,7 +128,6 @@ def getModuleActionInformationDict(**kw):
print_list.append((translated_title, module_print_list))
# Add the actions, only if they are not empty.
action_list_dict = {}
for k, v in (('add', add_list), ('search', search_list),
('exchange', exchange_list), ('report', report_list),
('print', print_list), ('view', view_list)):
......
......@@ -10,7 +10,6 @@ def getConfiguredStatusDict():
express_pref_dict = context.ERP5Site_getExpressPreferenceDict()
subscription_status = express_pref_dict.get('subscription_status')
configuration_status = express_pref_dict.get('configuration_status')
user_id = express_pref_dict.get('user_id')
SUPPORT_ENABLED = 'support_enabled'
......@@ -39,7 +38,6 @@ basic_mode, dms_mode, express_mode = getConfiguredStatusDict()
member = portal.portal_membership.getAuthenticatedMember()
role_list = list(member.getRoles())
role_list.sort()
group_list = ()
getGroups = getattr(member, 'getGroups', None)
if role_list == ['Authenticated', 'Member'] and not getGroups():
basic_mode = False
......
language = context.Localizer.get_selected_language()
SUPPORT_ENABLED = 'support_enabled'
SUPPORT_DISABLED = 'support_disabled'
ADVERTISEMENT_ENABLED = 'advertisement_enabled'
if express_mode==SUPPORT_ENABLED:
# For Express users.
......
if select_favorite is None:
select_favorite = context.REQUEST.form["Base_doFavorite"]
if select_favorite is None:
select_favorite = context.REQUEST.form["Base_doFavorite"]
if select_favorite == '':
return
# XXX more encode should be implemented in ERP5Site_redirect.
......
# pylint: disable=redefined-builtin
# select_language is a builtin because of Localizer add in builtins and pylint uses it as it runs in same process as ERP5.
# https://lab.nexedi.com/nexedi/erp5/blob/52146f5e3abf538c056a1ab2ffd124757c4825d6/product/Localizer/itools/i18n/accept.py#L163
import re
try:
......
......@@ -29,7 +29,7 @@ def addDialogIfNeeded(url):
# try to get format parameter if exists
parameter_kw = {}
format = ''
target_format = ''
if len(action_list) > 1:
parameter_list = action.split('?')[1]
parameter_tuple_list = [tuple(tuple_parameter.split('=')) for tuple_parameter in parameter_list.split('&')]
......@@ -44,13 +44,13 @@ def addDialogIfNeeded(url):
base_content_type = form.getProperty('content_type')
if parameter_kw.has_key('format'):
# if format is passed in action url: remove it
format = parameter_kw.pop('format')
target_format = parameter_kw.pop('format')
action = '%s?%s' % (action_id, '&'.join(['='.join(tuple_parameter) for tuple_parameter in parameter_kw.items()]))
url = '%s/Base_viewOOoPrintDialog?dialog_action_url=%s&base_content_type=%s&field_your_format=%s' % (
context.absolute_url(),
url_quote('%s/%s' % (absolute_url, action)),
url_quote(base_content_type),
url_quote(format))
url_quote(target_format))
elif not (hasattr(form, 'pt') and form.pt == 'form_dialog'):
url = '%s/Base_viewIntermediatePrintDialog?dialog_action_url=%s' % (
context.absolute_url(), url_quote('%s/%s' % (absolute_url, action)))
......
# pylint: disable=redefined-builtin
# this script uses format argument
if '?' in dialog_action_url:
dialog_action_url = '%s&form_id=%s' % (dialog_action_url, form_id)
else:
......
......@@ -20,9 +20,9 @@ def getFieldDescription(field_id):
properties = document.propertyMap()
except AttributeError: # If context has no propertyMap, give up
properties = []
for property in properties:
if split_id[1] == property['id']:
desc = property.get('description', '')
for prop in properties:
if split_id[1] == prop['id']:
desc = prop.get('description', '')
break
return desc
......
# Return first listbox in a form that is enabled and not hidden
# Christophe Dumez <christophe@nexedi.com>
# This script should be used to detect a listbox without having to name it "listbox"
form=context
......@@ -22,5 +21,5 @@ def isListBox(field):
# the listbox is there.
for group in ('bottom', 'center', 'left', 'right', 'Default'):
for field in form.get_fields_in_group(group):
if isListBox(field) and not(field['hidden']) and field['enabled']:
return field
if isListBox(field) and not(field['hidden']) and field['enabled']:
return field
......@@ -7,7 +7,7 @@ portal_url = utool()
result = []
param = int(context.REQUEST.get('ignore_layout', 0)) and '?ignore_layout:int=1' or ''
if include_root:
result.append( { 'id' : 'root'
result.append( { 'id' : 'root'
, 'title' : ptool.title()
, 'url' : '%s/view%s' % (portal_url, param)
}
......@@ -19,14 +19,14 @@ portal = utool.getPortalObject()
obj = portal
now = []
for name in relative:
obj = obj.restrictedTraverse(name)
now.append(name)
title = (
obj = obj.restrictedTraverse(name)
now.append(name)
title = (
getattr(obj, "getCompactTranslatedTitle", lambda: None)() or
obj.getTitle() or obj.getId()
)
if not name == 'talkback':
result.append( { 'id' : name
)
if not name == 'talkback':
result.append( { 'id' : name
, 'title' : title
, 'url' : '%s/%s/view%s' % (portal_url, '/'.join(now), param)
}
......
......@@ -42,13 +42,6 @@ car_width = 6
depth_width = 10
# the same over the vertical axis
depth_height = 10
# mid block size in wich we try to insert text
block_width = 40
# margin between the block and the delimitation (this permits to have
# blocks a bit smaller that lines or columns)
margin = 5
size_planning_width = basic.field.get_value('size_planning_width')
size_x_axis_height = basic.field.get_value('size_x_axis_height')
......
......@@ -84,12 +84,12 @@ for area_name in properties_structure.keys():
returned_list.append('.%s{' % class_name)
else:
returned_list.append('#%s{' % class_name)
for id in css_dict[class_name].keys():
if same_type(css_dict[class_name][id],''):
returned_list.append('%s:%s;\n' % (id,css_dict[class_name][id]))
for id_ in css_dict[class_name].keys():
if same_type(css_dict[class_name][id_], ''):
returned_list.append('%s:%s;\n' % (id_, css_dict[class_name][id_]))
else:
# if data is type float or integer then need to add 'px' at the end
returned_list.append('%s:%s%s;\n' % (id, int(css_dict[class_name][id] + 0.5),'px'))
returned_list.append('%s:%s%s;\n' % (id_, int(css_dict[class_name][id_] + 0.5), 'px'))
returned_list.append('}\n')
returned_list.append(" \
.planning_box_topleft{ position:absolute;left:0;top:0;} \n \
......
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