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

erp5_forge coding style

Enable coding style on erp5_forge, after removing several problematic scripts that did not seem used.

See merge request nexedi/erp5!1134
parents b9beb439 9f2fa835
Pipeline #9713 failed with stage
......@@ -49,7 +49,7 @@ def getActionTitleListFromAllActionProvider(portal):
for provider in provider_list:
for action in provider.listActions():
result.append((action.title, provider.getId()))
result.append((action.title, provider.getId()))
return result
......@@ -60,10 +60,10 @@ from zope.tal.talgenerator import TALGenerator
from zope.tal.dummyengine import name_match
def findStaticTranslationText(page_template, func_name_list):
def iterate(node, target_name, function):
if type(node) is list:
if isinstance(node, list):
for i in node:
iterate(i, target_name, function)
elif type(node) is tuple and node:
elif isinstance(node, tuple) and node:
if node[0]==target_name:
function(node)
else:
......@@ -100,8 +100,8 @@ def findStaticTranslationText(page_template, func_name_list):
tal_expression = tal_expression[1:-1]
match = name_match(tal_expression)
if match:
type, expression = match.group(1, 2)
if type=='python':
type_, expression = match.group(1, 2)
if type_=='python':
# clean up expression
expression = expression.strip()
expression = expression.replace('\n', ' ')
......@@ -139,7 +139,7 @@ class MyDummyTALInterpreter(TALInterpreter):
_i18n_message_id_dict = None
_currentTag = None
def translate(self, msgid, default=None, i18ndict=None, obj=None):
def translate(self, msgid, default=None, i18ndict=None, obj=None): # pylint:disable=arguments-differ
try:
self._i18n_message_id_dict[msgid] = None
except TypeError:
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Glossary</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.Glossary</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......
# -*- coding: utf-8 -*-
# pylint: disable-all
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
......
......@@ -80,7 +80,7 @@ class SubversionLoginError(SubversionError):
"""
# Declarative Security
security = ClassSecurityInfo()
def __init__(self, realm = None):
def __init__(self, realm = None): # pylint:disable=super-init-not-called
self._realm = realm
security.declarePublic('getRealm')
......@@ -96,7 +96,7 @@ class SubversionSSLTrustError(SubversionError):
# Declarative Security
security = ClassSecurityInfo()
def __init__(self, trust_dict = None):
def __init__(self, trust_dict = None): # pylint:disable=super-init-not-called
self._trust_dict = trust_dict
security.declarePublic('getTrustDict')
......@@ -134,7 +134,7 @@ try:
return False, ''
class GetLoginCallback(Callback):
def __call__(self, realm, username, may_save):
def __call__(self, realm, username, may_save): # pylint:disable=arguments-differ
user, password = self.client.getLogin(realm)
if not username or not password:
self.client.setException(SubversionLoginError(realm))
......@@ -147,12 +147,12 @@ try:
return True, user, password, False
class NotifyCallback(Callback):
def __call__(self, event_dict):
def __call__(self, event_dict): # pylint:disable=arguments-differ
# FIXME: should accumulate information for the user
pass
class SSLServerTrustPromptCallback(Callback):
def __call__(self, trust_dict):
def __call__(self, trust_dict): # pylint:disable=arguments-differ
if not self.client.trustSSLServer(trust_dict):
self.client.setException(SubversionSSLTrustError(trust_dict))
return False, 0, False
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SubversionClient</string> </value>
......@@ -43,13 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 83, 2: __init__ method from base class \'SubversionError\' is not called (super-init-not-called)</string>
<string>W: 99, 2: __init__ method from base class \'SubversionError\' is not called (super-init-not-called)</string>
<string>W:137, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
<string>W:150, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
<string>W:155, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -59,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -78,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -87,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -36,7 +36,7 @@ from AccessControl import Unauthorized
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Acquisition import aq_base, Implicit
from App.config import getConfiguration
from App.config import getConfiguration # pylint:disable=no-name-in-module,import-error
from DateTime import DateTime
from ZTUtils import make_query
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>BugModule_sendOpenBugListReminder</string> </value>
</item>
<item>
<key> <string>alarm_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1158577260.0</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Sends a summary email with all open bugs.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>open_bugs_alarm</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>13</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple>
<int>1</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1157061600.0</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_stop_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>32503676400.0</float>
<string>GMT+1</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_week_day</string> </key>
<value>
<tuple>
<string>Monday</string>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_week_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Open bugs alarm</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
installed_bts = context.getPortalObject()['portal_templates'].getInstalledBusinessTemplatesList()
for bt in installed_bts:
if file in bt.getItemsList():
return bt.getId()
built_bts = context.getPortalObject()['portal_templates'].getBuiltBusinessTemplatesList()
for bt in built_bts:
if file in bt.getItemsList():
return bt.getId()
return None
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>file, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getOriginalBusinessTemplateId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Document import newTempBase
## Stuff that is ignored
#- everything that is not in a portal_*
#- portal_trash, portal_categories, portal_templates, portal_preferences
#- objects whose meta-type is 'External Method' or 'Filesystem*'
#- 'portal_skins/external_method' & 'portal_skins/custom'
#- 'portal_workflow/business_template_building_workflow' & 'portal_workflow/business_template_installation_workflow'
#- 'portal_catalog/erp5_mysql' & 'portal_catalog/cps3_mysql' & 'portal_types/Business Template'
##
portals_scanned = ['portal_actions', 'portal_memberdata', 'portal_skins', 'portal_types', 'portal_undo', 'portal_url', 'portal_workflow', 'portal_discussion', 'portal_membership', 'portal_registration', 'portal_properties', 'portal_metadata', 'portal_syndication', 'portal_uidannotation', 'portal_uidgenerator', 'portal_uidhandler', 'portal_report', 'portal_rules', 'portal_ids', 'portal_simulation', 'portal_alarms', 'portal_domains', 'portal_deliveries', 'portal_orders', 'portal_catalog', 'portal_selections', 'portal_synchronizations', 'portal_activities']
orphans_list = []
if object is None:
object = context
objects = object.objectValues()
for o in objects:
object_path = '/'.join(o.getPhysicalPath()[2:])
if 'portal_skins/external_method' in object_path or \
'portal_skins/custom' in object_path or \
'portal_workflow/business_template_building_workflow' in object_path or \
'portal_workflow/business_template_installation_workflow' in object_path or \
'portal_catalog/erp5_mysql' in object_path or \
'portal_catalog/cps3_mysql' in object_path or\
'portal_types/Business Template' in object_path:
continue
if (object is not context) or (object_path.split('/')[0] in portals_scanned):
if not o.meta_type.startswith('Filesystem') and o.meta_type != 'External Method':
context.log("lol", object_path)
if not context.getPortalObject().Base_getOriginalBusinessTemplateId(file=object_path):
if object_path not in portals_scanned:
# orphan object
orphans_list.append(object_path)
# Recursively check children
orphans_list.extend([x.uid for x in context.Base_getOrphanObjects(object=o)])
object_list = []
for orphan in orphans_list:
my_dict = {}
my_dict['uid'] = orphan
temp_object = newTempBase(folder=context.getPortalObject(), id='1234')
temp_object.edit(**my_dict)
object_list.append(temp_object)
return object_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>object=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getOrphanObjects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from erp5.component.module.SubversionClient import SubversionSSLTrustError
from Products.ERP5Type.Document import newTempBase
portal = context.getPortalObject()
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>bottom</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>title_orphan</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_viewOrphanObjectList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_viewOrphanObjectList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Orphan Files</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ListBox" module="Products.ERP5Form.ListBox"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>all_editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>select</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>all_editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>select</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>all_editable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>uid</string>
<string>File Path</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string>manage_main</string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>select</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>Base_view_orphan_objects_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Orphan Files</string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
<string>uid</string>
<string>#</string>
</tuple>
</list>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.MethodField</string>
<string>Method</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Base_getOrphanObjects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>title_orphan</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Orphan Objects (Objects not Included in a Business Template)</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -18,10 +18,10 @@ if from_url is None:
user = context.portal_membership.getAuthenticatedMember().getUserName()
from_url = '"%s" <%s>' % (user,
context.email_from_address)
# Return-Path
# Return-Path. TODO: this is not implemented
if reply_url is None:
reply_url = context.portal_preferences.getPreferredEventSenderEmail()
additional_headers = None
additional_headers = None # pylint: disable=unused-variable
if reply_url:
additional_headers = {'Return-Path':reply_url}
......@@ -44,7 +44,6 @@ elif same_type(to_url, ''):
# Attachments
if attachment_list is None:
attachment_list = []
document_type_list = context.getPortalDocumentTypeList()
for attachment in context.getAggregateValueList():
mime_type, content = attachment.getMimeTypeAndContent()
name = attachment.getReference()
......
portal = context.getPortalObject()
bug_module = portal.bug_module
server_url = portal.ERP5Site_getAbsoluteUrl()
body_text_line_list = []
addBodyLine = body_text_line_list.append
bug_count = 0
assigned_to_dict={}
not_assigned_bug_list=[]
for bug in bug_module.searchFolder(portal_type='Bug',
simulation_state=('confirmed', 'set_ready',),
sort_on=(('id', 'asc', 'int'),)):
bug = bug.getObject()
if bug.getSource():
assigned_to_dict.setdefault(bug.getSource(), []).append(bug)
else:
not_assigned_bug_list.append(bug)
bug_count += 1
for assignee, bug_list in assigned_to_dict.items():
addBodyLine(" Assigned to %s:" % bug_list[0].getSourceTitle())
for bug in bug_list:
addBodyLine(" [%s] %s" % (bug.getReference(), bug.getTitle()))
addBodyLine(" %s/%s/view" % (server_url, bug.getRelativeUrl()))
addBodyLine('')
addBodyLine('')
if not_assigned_bug_list:
addBodyLine('')
addBodyLine(" Not assigned:")
for bug in not_assigned_bug_list:
addBodyLine(" [%s] %s" % (bug.getReference(), bug.getTitle()))
addBodyLine(" %s/%s/view" % (server_url, bug.getRelativeUrl()))
addBodyLine('')
if bug_count:
portal.portal_notifications.sendMessage(sender=None,
recipient=[],
subject="%s: %s Open Bugs" % (portal.title_or_id(), bug_count,),
message='\n'.join(body_text_line_list))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BugModule_sendOpenBugListReminder</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,6 +2,9 @@
This script creates a new event with given metadata and
attaches it to the current ticket.
"""
# pylint:disable=redefined-builtin
# this script uses file= argument
translateString = context.Base_translateString
default_bug_line = getattr(context, "default_bug_line", None)
......
"""Return a po file from a spreadsheet of categories."""
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Document import newTempBase
# Initialise some general variables
detailed_report_result = []
detailed_report_append = detailed_report_result.append
category_dict = {}
translation_dict = {}
translated_attributes_list = ["title", "description", "short_title"]
import_filename = getattr(import_file, 'filename', '?')
......@@ -31,14 +29,11 @@ def invalid_category_spreadsheet_handler(message):
category_list_mapping = context.Base_getCategoriesSpreadSheetMapping(import_file,
invalid_spreadsheet_error_handler=invalid_category_spreadsheet_handler)
if category_list_mapping.has_key('error_list'):
context.REQUEST.other['category_import_report'] = initial_category_list_mapping['error_list']
return context.CategoryTool_viewImportReport()
assert 'error_list' not in category_list_mapping
#Process on each category
for base_category, category_list in category_list_mapping.items():
for category_list in category_list_mapping.values():
for category in category_list:
#Take only needed attributes
for attribute in translated_attributes_list:
......
......@@ -6,8 +6,7 @@ for o in template_tool.contentValues(portal_type='Business Template'):
if portal_type in o.getTemplatePortalTypeIdList():
matching.append(o.getUid())
else:
allowed_content_type_list = o.getTemplatePortalTypeAllowedContentTypeList()
allowed_content_type_list = map(lambda x: x and x.split('|')[1].strip(), allowed_content_type_list)
allowed_content_type_list = [x for x in o.getTemplatePortalTypeAllowedContentTypeList() if x and x.split('|')[1].strip()]
if portal_type in allowed_content_type_list:
matching.append(o.getUid())
......
kw.update(context.REQUEST.form)
def getObjectFromArg(argument):
"""
Return an object identified by argument.
If argument is a string, assume it's the path to the object.
Otherwise, assume it's the object itself.
"""
if isinstance(argument, str):
return context.restrictedTraverse(argument)
return argument
kw_value_list = kw.values()
kw_len = len(kw_value_list)
if kw_len == 1:
object_a = context
object_b = getObjectFromArg(kw_value_list[0])
elif kw_len == 2:
kw_value_list = kw.values()
object_a = getObjectFromArg(kw_value_list[0])
object_b = getObjectFromArg(kw_value_list[1])
else:
raise ValueError, '%s is not a valid number of arguments for diff.' % (kw_len, )
diff_dict, missing_in_a_dict, missing_in_b_dict = diff_recursive(object_a, object_b)
context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html; charset=utf-8')
print '<html>'
print '<head><title>Diff between %s and %s</title></head>' % (object_a.id, object_b.id)
print '<body><pre>'
print '--- <a href="%s">%s</a>' % (object_a.absolute_url(), object_a.id)
print '+++ <a href="%s">%s</a>' % (object_b.absolute_url(), object_b.id)
print '</pre><h1>Modified files</h1><ul>'
for id, diff in diff_dict.items():
print '<li><b>%s</b><pre>' % (id, )
for line in diff:
print line
print '</pre></li>'
print '</ul>'
if len(missing_in_a_dict):
print '<h1>Objects missing in first object</h1><ul>'
for id in missing_in_a_dict.keys():
print '<li>%s</li>' % (id, )
print '</ul>'
if len(missing_in_b_dict):
print '<h1>Objects missing in second object</h1><ul>'
for id in missing_in_b_dict.keys():
print '<li>%s</li>' % (id, )
print '</ul>'
print '</body></html>'
return printed
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>diff</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -17,7 +17,7 @@ for i in catalog(portal_type='Glossary Term',
language_id=language) is not None:
continue
new_term = glossary_module.newContent(portal_type='Glossary Term',
glossary_module.newContent(portal_type='Glossary Term',
reference=reference,
business_field=business_field,
language=language,
......
......@@ -2,10 +2,10 @@ result = context.GlossaryModule_getTermDictListFromPortalType(portal_type_list)
if export_tsv:
for i in result:
print '\t'.join(map(lambda x:'"%s"'%x, (i['reference'], i['language'],
print '\t'.join(['"%s"' % x for x in (i['reference'], i['language'],
i['business_field'],
i['title'], i['description'],
i['field_path'])))
i['field_path'])])
return printed
else:
portal_catalog = context.portal_catalog
......
......@@ -2,10 +2,10 @@ result = context.GlossaryModule_getTermDictListFromPropertySheet(property_sheet_
if export_tsv:
for i in result:
print '\t'.join(map(lambda x:'"%s"'%x, (i['reference'], i['language'],
print '\t'.join(['"%s"' % x for x in (i['reference'], i['language'],
i['business_field'],
i['title'], i['description'],
i['field_path'])))
i['field_path'])])
return printed
else:
portal_catalog = context.portal_catalog
......
......@@ -2,9 +2,11 @@ result = context.GlossaryModule_getTermDictListFromWorkflow(template_list)
if export_tsv:
for i in result:
print '\t'.join(map(lambda x:'"%s"'%x, (i['reference'], i['language'],
print '\t'.join(['"%s"' % x for x in (i['reference'], i['language'],
i['business_field'],
i['title'], i['description'], i['workflow_id'])))
i['title'], i['description'],
i['workflow_id'])])
return printed
else:
portal_catalog = context.portal_catalog
......
from Products.ERP5Type.Document import newTempBase
result = []
portal_catalog = context.portal_catalog
portal_skins = context.portal_skins
......
from Products.ERP5Type.Document import newTempBase
result = []
portal_catalog = context.portal_catalog
portal_skins = context.portal_skins
def get_term_list(reference):
reference = reference.rsplit(' Module', 1)[0]
......@@ -26,7 +23,7 @@ for reference in portal_type_list:
field_description = portal_type.description
if len(term_list) == 1 and \
term_list[0].getDescription() == field_description:
continue
continue
line = newTempBase(context, 'tmp_glossary_field_%s' % c)
line.edit(field_path=reference,
......
from Products.ERP5Type.Document import newTempBase
marker = []
result = []
portal_catalog = context.portal_catalog
portal_workflow = context.portal_workflow
......@@ -40,7 +39,7 @@ line_list = []
c = 0
item_dict = {}
for business_field in business_field_list:
for wf_item, reference, type in get_obj_and_reference_list(business_field):
for wf_item, reference, type_ in get_obj_and_reference_list(business_field):
term_list = get_term_list(business_field, reference)
#if not term_list:
# continue
......@@ -49,21 +48,21 @@ for business_field in business_field_list:
item_dict[wf_item] = True
c += 1
if type == 'workflow':
if type_ == 'workflow':
wf_item_path = wf_item.id
wf_item_title = wf_item.title
elif type == 'state':
elif type_ == 'state':
wf_item_path = '%s/states/%s' % (wf_item.aq_parent.aq_parent.id, wf_item.id)
wf_item_title = wf_item.title
elif type == 'transition':
elif type_ == 'transition':
wf_item_path = '%s/transitions/%s' % (wf_item.aq_parent.aq_parent.id, wf_item.id)
wf_item_title = wf_item.title
else: # type == 'action'
else: # type_ == 'action'
wf_item_path = '%s/transitions/%s_actbox_name' % (wf_item.aq_parent.aq_parent.id, wf_item.id)
wf_item_title = wf_item.actbox_name
wf_item_description = wf_item.description
if type == 'transition' and wf_item_path.endswith('_action'):
if type_ == 'transition' and wf_item_path.endswith('_action'):
if len(term_list) == 1 and \
term_list[0].getTitle() + ' Action' == wf_item_title and \
term_list[0].getDescription() == wf_item_description:
......@@ -76,7 +75,7 @@ for business_field in business_field_list:
line = newTempBase(context, 'tmp_glossary_wf_item_%s' % c)
line.edit(wf_item_path=wf_item_path,
wf_item_type=type,
wf_item_type=type_,
wf_item_title=wf_item_title,
wf_item_edit_url = "%s/manage_properties" % wf_item.absolute_url(),
wf_item_description = wf_item_description,
......
......@@ -14,13 +14,13 @@ msgstr %s
return MESSAGE_TEMPLATE % dict(english=english, translation=translation)
def format(string):
def formatString(string):
line_list = string.splitlines(True)
length = len(line_list)
if length==1:
return '"%s"' % string.replace('"', '\\"').replace('\n', '\\n')
else:
return '\n'.join(['""']+[format(i) for i in line_list])
return '\n'.join(['""']+[formatString(i) for i in line_list])
# po header
now = DateTime().toZone('UTC').strftime("%Y-%m-%d %H:%M+0000")
......@@ -43,7 +43,6 @@ for i in catalog(portal_type='Glossary Term',
language_id=language):
term = i.getObject()
reference = term.getReference()
business_field = term.getBusinessField()
english_term = catalog.getResultValue(portal_type='Glossary Term',
validation_state='validated',
......@@ -52,7 +51,6 @@ for i in catalog(portal_type='Glossary Term',
business_field_uid=term.getBusinessFieldUid())
if english_term is None:
continue
raise ValueError, 'Corresponding English term to "%s" does not exist in glossary.' % term.Title()
translated_title = term.getTitle()
translated_description = term.getDescription()
......@@ -65,8 +63,8 @@ for i in catalog(portal_type='Glossary Term',
if not english_title:
raise ValueError, 'Title of corresponding English term(%s) to "%s" is empty.' % (english_relative_url, translated_title)
if translated_title!=english_title:
print formatMessage(english=format(english_title),
translation=format(translated_title),
print formatMessage(english=formatString(english_title),
translation=formatString(translated_title),
term=term)
if translated_description:
......@@ -74,8 +72,8 @@ for i in catalog(portal_type='Glossary Term',
raise ValueError, 'Description of corresponding English term(%s) to "%s" is empty.' % (english_relative_url, translated_description)
if translated_description!=english_description:
print formatMessage(english=format(english_description),
translation=format(translated_description),
print formatMessage(english=formatString(english_description),
translation=formatString(translated_description),
term=term)
RESPONSE = context.REQUEST.RESPONSE
......
......@@ -17,20 +17,20 @@ for i in property_sheet_list:
dic = {}
for i in all_field_list:
id = i.getId()
id_ = i.getId()
title = i.get_value('title') or ''
skin_id = i.aq_parent.aq_parent.getId()
prefix = 'erp5_'
if skin_id.startswith(prefix):
skin_id = skin_id[len(prefix):]
if id.startswith('my_'):
if id_.startswith('my_'):
for p in properties:
if id=='my_%s' % p:
if id_=='my_%s' % p:
key = (p, skin_id, title)
dic[key] = i
if id.startswith('your_'):
if id_.startswith('your_'):
for p in properties:
if id=='your_%s' % p:
if id_=='your_%s' % p:
key = (p, skin_id, title)
dic[key] = i
......
prefix = 'field_listbox_term_'
prefix_length = len(prefix)
portal_types = context.portal_types
portal_catalog = context.portal_catalog
for i in kw.keys():
......
......@@ -2,11 +2,11 @@
# Author: Lukasz Nowak <lukasz.nowak@ventis.com.pl>
# Copyright 2007 Ventis s. c.
# SYNOPSIS
# This script exctracts simulations (Applied Rule and Simulation Movement) for context.
# This script extracts simulations (Applied Rule and Simulation Movement) for context.
# If start_path is given it instead extracts tree with root as given start_path.
def getByRecurse(obj,rv=[]):
def getByRecurse(obj):
rv = []
for o in [q.getObject() for q in obj.searchFolder()]:
rv.append(getByRecurse(o))
......
......@@ -74,10 +74,10 @@ for i in form_list:
if (i.getId().endswith('FieldLibrary')):
continue
add_message(i.title, portal_url.getRelativeContentURL(i))
for group, list in i.groups.items():
for group, list_ in i.groups.items():
if group == 'hidden':
continue
for j in (i[x] for x in list):
for j in (i[x] for x in list_):
add_message(j.get_value('title'), portal_url.getRelativeContentURL(j))
if j.get_value('editable'):
add_message(j.get_value('description'), portal_url.getRelativeContentURL(j))
......@@ -104,20 +104,19 @@ for i in page_template_list:
#
# Workflow
#
s_title_list = []
for i in context.portal_workflow.objectValues():
add_message(i.title_or_id(), portal_url.getRelativeContentURL(i))
if not i.states:
continue
for s in i.states.values():
s_title = s.title
if s_title:
# adding a context in msg_id for more precise translation
msg_id = getMessageIdWithContext(s_title,'state',i.id)
add_message(msg_id, portal_url.getRelativeContentURL(s))
# also use state title as msg_id for compatibility
add_message(s_title, portal_url.getRelativeContentURL(s))
s_title = s.title
if s_title:
# adding a context in msg_id for more precise translation
msg_id = getMessageIdWithContext(s_title,'state',i.id)
add_message(msg_id, portal_url.getRelativeContentURL(s))
# also use state title as msg_id for compatibility
add_message(s_title, portal_url.getRelativeContentURL(s))
if not i.transitions:
continue
......@@ -164,13 +163,13 @@ for property_sheet in context.portal_property_sheets.objectValues():
#
# Output
#
def format(string):
def formatString(string):
line_list = string.split('\n')
length = len(line_list)
if length==1:
return '"%s"' % string.replace('"', '\\"')
else:
return '\n'.join(['""']+[format(i) for i in line_list])
return '\n'.join(['""']+[formatString(i) for i in line_list])
print '''msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
......@@ -188,7 +187,7 @@ for message in message_list:
comment_list = message_dict[message]
comment_list.sort()
comment = '\n'.join([('#: %s' % i) for i in comment_list])
print MESSAGE_TEMPLATE % (comment, format(message))
print MESSAGE_TEMPLATE % (comment, formatString(message))
RESPONSE = context.REQUEST.RESPONSE
RESPONSE.setHeader('Content-disposition', 'attachment;filename=translation.pot')
......
......@@ -4,9 +4,9 @@ result = []
def setCache(skin):
for o in skin.objectValues():
id = o.id
if callable(id): id = id()
if o.meta_type in ('Image', 'File', 'Filesystem Image', 'Filesystem File') or id.endswith('.css') or id.endswith('.js'):
id_ = o.id
if callable(id_): id_ = id_()
if o.meta_type in ('Image', 'File', 'Filesystem Image', 'Filesystem File') or id_.endswith('.css') or id_.endswith('.js'):
if o.ZCacheable_getManagerId() != cache_manager_id:
o.ZCacheable_setManagerId(cache_manager_id)
result.append(o.absolute_url(relative=1))
......
# set this to the name of the script you want to save in container
output_script_name='output' # None
script = "## autogenerated by %s\n" % script
for pdf in container.objectValues('ERP5 PDF Form') :
script+= "form = container['%s']\n" % pdf.id()
for cell in pdf.getCellNames():
script+= 'form.setCellTALES("%s", "%s")\n' % (cell, pdf.getCellTALES(cell).replace("\\", "\\\\").replace('"', '\\"'))
script += "form.setPageRangeTALES('%s')\n" % pdf.getPageRangeTALES()
# script += "form.setDisplayZerosTALES('%s')\n" % pdf.getDisplayZerosTALES()
script += "\n\n"
if not output_script_name :
return script
container.manage_addProduct['PythonScripts'].manage_addPythonScript(output_script_name)
container[output_script_name].write(script)
return "%s saved" % output_script_name
# stock of utility functions
for pdf in container.objectValues('ERP5 PDF Form') :
for cell in pdf.getCellNames() :
if pdf.getCellTALES(cell) in ( "", None ) :
pdf.setCellTALES(cell, 'python:0')
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PdfForm_dumpForms</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -6,7 +6,7 @@ for form_path, form in context.ZopeFind(
context.portal_skins, obj_metatypes=['ERP5 Form'], search_sub=1):
try:
groups = form.get_groups()
except AttributeError, e:
except AttributeError as e:
print "%s is broken: %s" % (form_path, e)
if 'not_assigned' in groups:
print 'Not assigned fields in %s: %s' % (form_path,
......
......@@ -10,4 +10,3 @@ except SubversionLoginError, error1 :
context.REQUEST.set('portal_status_message', 'Server needs authentication, no cookie found')
return context.asContext(caller='info', realm = error1.getRealm(), username = vcs_tool.getPreferredUsername()).BusinessTemplate_viewSvnLogin()
return entry_dict
return context.asContext(entry_dict=entry_dict).BusinessTemplate_viewSvnInfos()
request = context.REQUEST
if caller_kw is None:
caller_kw = {}
trust_dict=dict((x, request[x]) for x in (
'valid_until', 'hostname', 'realm', 'finger_print', 'valid_from', 'issuer_dname', 'failures'))
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>caller, caller_kw={}, added=(), removed=(), modified=(), changelog=None, **kw</string> </value>
<value> <string>caller, caller_kw=None, added=(), removed=(), modified=(), changelog=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from erp5.component.module.SubversionClient import SubversionSSLTrustError, SubversionLoginError
from Products.ERP5Type.Document import newTempBase
# get selected business templates
p = context.getPortalObject()
selection_name = 'business_template_selection' # harcoded because we can also get delete_selection
......
if caller_kw is None:
caller_kw = {}
context.getVcsTool().setLogin(auth, user, password)
return context.restrictedTraverse(caller)(**caller_kw)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>user, password, auth, caller, caller_kw={}, added=(), modified=(), removed=(), changelog=None, **kw</string> </value>
<value> <string>user, password, auth, caller, caller_kw=None, added=(), modified=(), removed=(), changelog=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
request = context.REQUEST
try:
files_list = context.REQUEST['uids']
files_list = request['uids']
except KeyError:
message = 'You MUST select at least one file.'
else:
context.getVcsTool().resolved(files_list)
message = 'Conflicted files resolved successfully.'
request.set("portal_status_message", message)
return context.BusinessTemplate_viewConflicted()
if "files" in context.REQUEST.keys():
files = context.REQUEST["files"];
else:
files = None;
return '''
var tree = null;
var business_template;
......
......@@ -56,9 +56,9 @@ lines_list = bug.searchFolder(portal_type='Bug Line', sort_on=(("id", "DESC"),),
bug_message_list.extend(lines_list)
message_count = len(bug_message_list)+1
for message in bug_message_list:
message_count -= 1
text = message.asText()
body += """
message_count -= 1
text = message.asText()
body += """
++++++ Message #%s submitted by %s on %s ++++++
%s
""" % (message_count, message.getSourceTitle(''),
......
portal_alarms/open_bugs_alarm
portal_categories/business_field/*
portal_domains/state_bug_domain
\ No newline at end of file
......@@ -168,6 +168,8 @@ ignored_skin_id_set = {
'TaskListsGadgetListbox_getLineCss',
'InventoryModule_reindexMovementList',
'DeliveryModule_mergeDeliveryList',
'ERP5VCS_doCreateJavaScriptDiff.js',
'ERP5VCS_doCreateJavaScriptStatus.js',
}
# Generic method to check consistency of a skin item
......
......@@ -104,6 +104,9 @@ def test_suite():
testXHTML.validator,
(tested_business_template,),
expected_failure_list=(
# this view needs VCS preference set (this test suite does not support
# setting preferences, but this might be a way to fix this).
'test_erp5_forge_Business_Template_BusinessTemplate_viewVcsStatus',
# this view only works when solver decision has a relation to a solver.
# One way to fix this would be to allow a custom "init script" to be called
# on a portal type.
......
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