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

Enable coding style for erp5_xhtml_style

/reviewed-on !1048
parents 159daa14 e8674e78
...@@ -128,7 +128,6 @@ def getModuleActionInformationDict(**kw): ...@@ -128,7 +128,6 @@ def getModuleActionInformationDict(**kw):
print_list.append((translated_title, module_print_list)) print_list.append((translated_title, module_print_list))
# Add the actions, only if they are not empty. # Add the actions, only if they are not empty.
action_list_dict = {}
for k, v in (('add', add_list), ('search', search_list), for k, v in (('add', add_list), ('search', search_list),
('exchange', exchange_list), ('report', report_list), ('exchange', exchange_list), ('report', report_list),
('print', print_list), ('view', view_list)): ('print', print_list), ('view', view_list)):
......
...@@ -10,7 +10,6 @@ def getConfiguredStatusDict(): ...@@ -10,7 +10,6 @@ def getConfiguredStatusDict():
express_pref_dict = context.ERP5Site_getExpressPreferenceDict() express_pref_dict = context.ERP5Site_getExpressPreferenceDict()
subscription_status = express_pref_dict.get('subscription_status') subscription_status = express_pref_dict.get('subscription_status')
configuration_status = express_pref_dict.get('configuration_status')
user_id = express_pref_dict.get('user_id') user_id = express_pref_dict.get('user_id')
SUPPORT_ENABLED = 'support_enabled' SUPPORT_ENABLED = 'support_enabled'
...@@ -39,7 +38,6 @@ basic_mode, dms_mode, express_mode = getConfiguredStatusDict() ...@@ -39,7 +38,6 @@ basic_mode, dms_mode, express_mode = getConfiguredStatusDict()
member = portal.portal_membership.getAuthenticatedMember() member = portal.portal_membership.getAuthenticatedMember()
role_list = list(member.getRoles()) role_list = list(member.getRoles())
role_list.sort() role_list.sort()
group_list = ()
getGroups = getattr(member, 'getGroups', None) getGroups = getattr(member, 'getGroups', None)
if role_list == ['Authenticated', 'Member'] and not getGroups(): if role_list == ['Authenticated', 'Member'] and not getGroups():
basic_mode = False basic_mode = False
......
language = context.Localizer.get_selected_language()
SUPPORT_ENABLED = 'support_enabled' SUPPORT_ENABLED = 'support_enabled'
SUPPORT_DISABLED = 'support_disabled' SUPPORT_DISABLED = 'support_disabled'
ADVERTISEMENT_ENABLED = 'advertisement_enabled'
if express_mode==SUPPORT_ENABLED: if express_mode==SUPPORT_ENABLED:
# For Express users. # For Express users.
......
# pylint: disable-all
from Products.PythonScripts.standard import html_quote from Products.PythonScripts.standard import html_quote
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.FCKeditor.utils import fckCreateValidZopeId from Products.FCKeditor.utils import fckCreateValidZopeId
......
# pylint: disable-all
from Products.PythonScripts.standard import html_quote from Products.PythonScripts.standard import html_quote
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
......
# pylint: disable-all
from Products.PythonScripts.standard import html_quote from Products.PythonScripts.standard import html_quote
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.FCKeditor.utils import fckCreateValidZopeId from Products.FCKeditor.utils import fckCreateValidZopeId
......
# pylint: disable-all
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.standard import html_quote from Products.PythonScripts.standard import html_quote
......
# Override this script to control user access to ERP5 XHTML-style rendering. # Override this script to control user access to ERP5 XHTML-style rendering.
pass
if select_favorite is None: if select_favorite is None:
select_favorite = context.REQUEST.form["Base_doFavorite"] select_favorite = context.REQUEST.form["Base_doFavorite"]
if select_favorite == '': if select_favorite == '':
return return
# XXX more encode should be implemented in ERP5Site_redirect. # 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 import re
try: try:
......
...@@ -29,7 +29,7 @@ def addDialogIfNeeded(url): ...@@ -29,7 +29,7 @@ def addDialogIfNeeded(url):
# try to get format parameter if exists # try to get format parameter if exists
parameter_kw = {} parameter_kw = {}
format = '' target_format = ''
if len(action_list) > 1: if len(action_list) > 1:
parameter_list = action.split('?')[1] parameter_list = action.split('?')[1]
parameter_tuple_list = [tuple(tuple_parameter.split('=')) for tuple_parameter in parameter_list.split('&')] parameter_tuple_list = [tuple(tuple_parameter.split('=')) for tuple_parameter in parameter_list.split('&')]
...@@ -44,13 +44,13 @@ def addDialogIfNeeded(url): ...@@ -44,13 +44,13 @@ def addDialogIfNeeded(url):
base_content_type = form.getProperty('content_type') base_content_type = form.getProperty('content_type')
if parameter_kw.has_key('format'): if parameter_kw.has_key('format'):
# if format is passed in action url: remove it # 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()])) 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' % ( url = '%s/Base_viewOOoPrintDialog?dialog_action_url=%s&base_content_type=%s&field_your_format=%s' % (
context.absolute_url(), context.absolute_url(),
url_quote('%s/%s' % (absolute_url, action)), url_quote('%s/%s' % (absolute_url, action)),
url_quote(base_content_type), url_quote(base_content_type),
url_quote(format)) url_quote(target_format))
elif not (hasattr(form, 'pt') and form.pt == 'form_dialog'): elif not (hasattr(form, 'pt') and form.pt == 'form_dialog'):
url = '%s/Base_viewIntermediatePrintDialog?dialog_action_url=%s' % ( url = '%s/Base_viewIntermediatePrintDialog?dialog_action_url=%s' % (
context.absolute_url(), url_quote('%s/%s' % (absolute_url, action))) context.absolute_url(), url_quote('%s/%s' % (absolute_url, action)))
......
# pylint: disable=redefined-builtin
# this script uses format argument
if '?' in dialog_action_url: if '?' in dialog_action_url:
dialog_action_url = '%s&form_id=%s' % (dialog_action_url, form_id) dialog_action_url = '%s&form_id=%s' % (dialog_action_url, form_id)
else: else:
......
...@@ -20,9 +20,9 @@ def getFieldDescription(field_id): ...@@ -20,9 +20,9 @@ def getFieldDescription(field_id):
properties = document.propertyMap() properties = document.propertyMap()
except AttributeError: # If context has no propertyMap, give up except AttributeError: # If context has no propertyMap, give up
properties = [] properties = []
for property in properties: for prop in properties:
if split_id[1] == property['id']: if split_id[1] == prop['id']:
desc = property.get('description', '') desc = prop.get('description', '')
break break
return desc return desc
......
# Return first listbox in a form that is enabled and not hidden # 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" # This script should be used to detect a listbox without having to name it "listbox"
form=context form=context
...@@ -22,5 +21,5 @@ def isListBox(field): ...@@ -22,5 +21,5 @@ def isListBox(field):
# the listbox is there. # the listbox is there.
for group in ('bottom', 'center', 'left', 'right', 'Default'): for group in ('bottom', 'center', 'left', 'right', 'Default'):
for field in form.get_fields_in_group(group): for field in form.get_fields_in_group(group):
if isListBox(field) and not(field['hidden']) and field['enabled']: if isListBox(field) and not(field['hidden']) and field['enabled']:
return field return field
...@@ -7,7 +7,7 @@ portal_url = utool() ...@@ -7,7 +7,7 @@ portal_url = utool()
result = [] result = []
param = int(context.REQUEST.get('ignore_layout', 0)) and '?ignore_layout:int=1' or '' param = int(context.REQUEST.get('ignore_layout', 0)) and '?ignore_layout:int=1' or ''
if include_root: if include_root:
result.append( { 'id' : 'root' result.append( { 'id' : 'root'
, 'title' : ptool.title() , 'title' : ptool.title()
, 'url' : '%s/view%s' % (portal_url, param) , 'url' : '%s/view%s' % (portal_url, param)
} }
...@@ -19,14 +19,14 @@ portal = utool.getPortalObject() ...@@ -19,14 +19,14 @@ portal = utool.getPortalObject()
obj = portal obj = portal
now = [] now = []
for name in relative: for name in relative:
obj = obj.restrictedTraverse(name) obj = obj.restrictedTraverse(name)
now.append(name) now.append(name)
title = ( title = (
getattr(obj, "getCompactTranslatedTitle", lambda: None)() or getattr(obj, "getCompactTranslatedTitle", lambda: None)() or
obj.getTitle() or obj.getId() obj.getTitle() or obj.getId()
) )
if not name == 'talkback': if not name == 'talkback':
result.append( { 'id' : name result.append( { 'id' : name
, 'title' : title , 'title' : title
, 'url' : '%s/%s/view%s' % (portal_url, '/'.join(now), param) , 'url' : '%s/%s/view%s' % (portal_url, '/'.join(now), param)
} }
......
...@@ -42,13 +42,6 @@ car_width = 6 ...@@ -42,13 +42,6 @@ car_width = 6
depth_width = 10 depth_width = 10
# the same over the vertical axis # the same over the vertical axis
depth_height = 10 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_planning_width = basic.field.get_value('size_planning_width')
size_x_axis_height = basic.field.get_value('size_x_axis_height') size_x_axis_height = basic.field.get_value('size_x_axis_height')
......
...@@ -84,12 +84,12 @@ for area_name in properties_structure.keys(): ...@@ -84,12 +84,12 @@ for area_name in properties_structure.keys():
returned_list.append('.%s{' % class_name) returned_list.append('.%s{' % class_name)
else: else:
returned_list.append('#%s{' % class_name) returned_list.append('#%s{' % class_name)
for id in css_dict[class_name].keys(): for id_ in css_dict[class_name].keys():
if same_type(css_dict[class_name][id],''): if same_type(css_dict[class_name][id_], ''):
returned_list.append('%s:%s;\n' % (id,css_dict[class_name][id])) returned_list.append('%s:%s;\n' % (id_, css_dict[class_name][id_]))
else: else:
# if data is type float or integer then need to add 'px' at the end # 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('}\n')
returned_list.append(" \ returned_list.append(" \
.planning_box_topleft{ position:absolute;left:0;top:0;} \n \ .planning_box_topleft{ position:absolute;left:0;top:0;} \n \
......
...@@ -124,6 +124,12 @@ ignored_skin_id_set = { ...@@ -124,6 +124,12 @@ ignored_skin_id_set = {
'PortalType_addAction', 'PortalType_addAction',
'PortalType_deleteAction', 'PortalType_deleteAction',
'RelationFieldZuite_CommonTemplate', 'RelationFieldZuite_CommonTemplate',
'Field_getDescription',
'ERP5XhtmlStyle_redirect',
'connectorCPS.py',
'connectorERP5',
'connectorPlone.py',
'resolveUid',
} }
# Generic method to check consistency of a skin item # Generic method to check consistency of a skin item
......
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