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

Enable coding style on more business templates

base, trade, pdm, mrp and dms

See merge request !1073
parents c500c464 0b0b2126
...@@ -56,7 +56,7 @@ class Currency(Resource): ...@@ -56,7 +56,7 @@ class Currency(Resource):
# Unit conversion # Unit conversion
security.declareProtected(Permissions.AccessContentsInformation, 'convertQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'convertQuantity')
def convertQuantity(self, quantity, from_unit, to_unit, variation_list=()): def convertQuantity(self, quantity, from_unit, to_unit, variation_list=(), transformed_resource=None, transformed_variation_list=()):
# 'variation_list' parameter may be deprecated: # 'variation_list' parameter may be deprecated:
# cf Measure.getConvertedQuantity # cf Measure.getConvertedQuantity
return quantity return quantity
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>Currency</string> </value> <value> <string>Currency</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Currency</string> </value> <value> <string>Products.ERP5.Document.Currency</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.Currency</string> </value> <value> <string>document.erp5.Currency</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 59, 2: Arguments number differs from overridden \'convertQuantity\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ from Products.ERP5Type.ImageUtil import transformUrlToDataURI ...@@ -54,7 +54,7 @@ from Products.ERP5Type.ImageUtil import transformUrlToDataURI
# import mixin # import mixin
from Products.ERP5.mixin.text_convertable import TextConvertableMixin from Products.ERP5.mixin.text_convertable import TextConvertableMixin
def getDefaultImageQuality(portal, format=None): def getDefaultImageQuality(portal, format=None): # pylint: disable=redefined-builtin
preference_tool = portal.portal_preferences preference_tool = portal.portal_preferences
return preference_tool.getPreferredImageQuality() return preference_tool.getPreferredImageQuality()
...@@ -173,7 +173,10 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -173,7 +173,10 @@ class Image(TextConvertableMixin, File, OFSImage):
return self.height return self.height
security.declareProtected(Permissions.AccessContentsInformation, 'getContentType') security.declareProtected(Permissions.AccessContentsInformation, 'getContentType')
def getContentType(self, default=_MARKER): def getContentType( # pylint: disable=arguments-differ,dangerous-default-value
self,
default=_MARKER,
):
"""Original photo content_type.""" """Original photo content_type."""
self._upgradeImage() self._upgradeImage()
if self.hasData() and not self.hasContentType(): if self.hasData() and not self.hasContentType():
...@@ -208,8 +211,13 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -208,8 +211,13 @@ class Image(TextConvertableMixin, File, OFSImage):
return links return links
security.declareProtected(Permissions.AccessContentsInformation, 'displayMap') security.declareProtected(Permissions.AccessContentsInformation, 'displayMap')
def displayMap(self, exclude=None, format=None, quality=_MARKER,\ def displayMap( # pylint: disable=dangerous-default-value
resolution=None): self,
exclude=None,
format=None, # pylint: disable=redefined-builtin
quality=_MARKER,
resolution=None,
):
"""Return list of displays with size info.""" """Return list of displays with size info."""
displays = [] displays = []
if quality is _MARKER: if quality is _MARKER:
...@@ -236,7 +244,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -236,7 +244,7 @@ class Image(TextConvertableMixin, File, OFSImage):
security.declarePrivate('_convertToText') security.declarePrivate('_convertToText')
def _convertToText(self, format): def _convertToText(self, format): # pylint: disable=redefined-builtin
""" """
Convert the image to text with portaltransforms Convert the image to text with portaltransforms
""" """
...@@ -258,7 +266,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -258,7 +266,7 @@ class Image(TextConvertableMixin, File, OFSImage):
return mime_type, result return mime_type, result
# Conversion API # Conversion API
def _convert(self, format, **kw): def _convert(self, format, **kw): # pylint: disable=redefined-builtin
""" """
Implementation of conversion for Image files Implementation of conversion for Image files
""" """
...@@ -319,7 +327,16 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -319,7 +327,16 @@ class Image(TextConvertableMixin, File, OFSImage):
# Photo processing # Photo processing
# #
def _resize(self, quality, width, height, format, resolution, frame, crop=False): def _resize(
self,
quality,
width,
height,
format, # pylint: disable=redefined-builtin
resolution,
frame,
crop=False,
):
"""Resize and resample photo.""" """Resize and resample photo."""
icc_profile = os.path.join(os.path.dirname(__file__), icc_profile = os.path.join(os.path.dirname(__file__),
'..', 'misc', 'sRGB.icc') '..', 'misc', 'sRGB.icc')
...@@ -376,7 +393,15 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -376,7 +393,15 @@ class Image(TextConvertableMixin, File, OFSImage):
return StringIO(image) return StringIO(image)
raise ConversionError('Image conversion failed (%s).' % err) raise ConversionError('Image conversion failed (%s).' % err)
def _getDisplayData(self, format, quality, resolution, frame, image_size, crop): def _getDisplayData(
self,
format, # pylint: disable=redefined-builtin
quality,
resolution,
frame,
image_size,
crop,
):
"""Return raw photo data for given display.""" """Return raw photo data for given display."""
if crop: if crop:
width, height = image_size width, height = image_size
...@@ -389,13 +414,19 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -389,13 +414,19 @@ class Image(TextConvertableMixin, File, OFSImage):
return self.getData() return self.getData()
return self._resize(quality, width, height, format, resolution, frame, crop) return self._resize(quality, width, height, format, resolution, frame, crop)
def _makeDisplayPhoto(self, format=None, quality=_MARKER, def _makeDisplayPhoto( # pylint: disable=dangerous-default-value
resolution=None, frame=None, image_size=None, self,
crop=False): format=None, # pylint: disable=redefined-builtin
quality=_MARKER,
resolution=None,
frame=None,
image_size=None,
crop=False,
):
"""Create given display.""" """Create given display."""
if quality is _MARKER: if quality is _MARKER:
quality = self.getDefaultImageQuality(format) quality = self.getDefaultImageQuality(format)
width, height = image_size width, height = image_size # pylint: disable=unpacking-non-sequence
base, ext = splitext(self.id) base, ext = splitext(self.id)
id_ = '%s_%s_%s.%s'% (base, width, height, ext,) id_ = '%s_%s_%s.%s'% (base, width, height, ext,)
image = OFSImage(id_, self.getTitle(), image = OFSImage(id_, self.getTitle(),
...@@ -453,7 +484,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -453,7 +484,7 @@ class Image(TextConvertableMixin, File, OFSImage):
self._update_image_info() self._update_image_info()
security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultImageQuality') security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultImageQuality')
def getDefaultImageQuality(self, format=None): def getDefaultImageQuality(self, format=None): # pylint: disable=redefined-builtin
""" """
Get default image quality for a format. Get default image quality for a format.
""" """
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>Image</string> </value> <value> <string>Image</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Image</string> </value> <value> <string>Products.ERP5.Document.Image</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.Image</string> </value> <value> <string>document.erp5.Image</string> </value>
...@@ -37,21 +49,7 @@ ...@@ -37,21 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 57, 35: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:176, 2: Dangerous default value _MARKER (__builtin__.list) as argument (dangerous-default-value)</string>
<string>W:176, 2: Arguments number differs from overridden \'getContentType\' method (arguments-differ)</string>
<string>W:211, 37: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:211, 2: Dangerous default value _MARKER (__builtin__.list) as argument (dangerous-default-value)</string>
<string>W:239, 27: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:261, 21: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:322, 44: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:379, 28: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:392, 30: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:392, 2: Dangerous default value _MARKER (__builtin__.list) as argument (dangerous-default-value)</string>
<string>W:398, 4: Attempting to unpack a non-sequence defined at line 393 (unpacking-non-sequence)</string>
<string>W:456, 35: Redefining built-in \'format\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -61,13 +59,28 @@ ...@@ -61,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -80,7 +93,7 @@ ...@@ -80,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -89,7 +102,7 @@ ...@@ -89,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -30,9 +30,9 @@ from AccessControl import ClassSecurityInfo ...@@ -30,9 +30,9 @@ from AccessControl import ClassSecurityInfo
from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin
from erp5.component.mixin.LoginAccountProviderMixin import LoginAccountProviderMixin from erp5.component.mixin.LoginAccountProviderMixin import LoginAccountProviderMixin
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
class Login(XMLObject, LoginAccountProviderMixin, EncryptedPasswordMixin): class Login(XMLObject, LoginAccountProviderMixin, EncryptedPasswordMixin):
meta_type = 'ERP5 Login' meta_type = 'ERP5 Login'
portal_type = 'Login' portal_type = 'Login'
......
...@@ -76,13 +76,13 @@ class MappedProperty(XMLObject): ...@@ -76,13 +76,13 @@ class MappedProperty(XMLObject):
return mapping_dict return mapping_dict
# XXX do we need to protect this method? # XXX do we need to protect this method?
def getMappedPropertyId(self, property, reverse=False): def getMappedPropertyId(self, property, reverse=False): # pylint: disable=redefined-builtin
return self.getMappingDict(reverse=reverse).get(property, property) return self.getMappingDict(reverse=reverse).get(property, property)
# Security should be handled by the target document not by the mapped # Security should be handled by the target document not by the mapped
# property document. # property document.
security.declarePublic('getMappedProperty') security.declarePublic('getMappedProperty')
def getMappedProperty(self, document, property): def getMappedProperty(self, document, property): # pylint: disable=redefined-builtin
if property.endswith('_list'): if property.endswith('_list'):
property = property[:-5] property = property[:-5]
getProperty = document.getPropertyList getProperty = document.getPropertyList
...@@ -98,7 +98,7 @@ class MappedProperty(XMLObject): ...@@ -98,7 +98,7 @@ class MappedProperty(XMLObject):
# Security should be handled by the target document not by the mapped # Security should be handled by the target document not by the mapped
# property document. # property document.
security.declarePublic('setMappedProperty') security.declarePublic('setMappedProperty')
def setMappedProperty(self, document, property, value): def setMappedProperty(self, document, property, value): # pylint: disable=redefined-builtin
if property.endswith('_list'): if property.endswith('_list'):
property = property[:-5] property = property[:-5]
setProperty = document.setPropertyList setProperty = document.setPropertyList
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>MappedProperty</string> </value> <value> <string>MappedProperty</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.MappedProperty</string> </value> <value> <string>Products.ERP5.Document.MappedProperty</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.MappedProperty</string> </value> <value> <string>document.erp5.MappedProperty</string> </value>
...@@ -37,11 +49,7 @@ ...@@ -37,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 79, 32: Redefining built-in \'property\' (redefined-builtin)</string>
<string>W: 85, 40: Redefining built-in \'property\' (redefined-builtin)</string>
<string>W:101, 40: Redefining built-in \'property\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -51,13 +59,28 @@ ...@@ -51,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -70,7 +93,7 @@ ...@@ -70,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -79,7 +102,7 @@ ...@@ -79,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
...@@ -190,7 +189,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -190,7 +189,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
return cached_getTargetFormatItemList(self.getBaseContentType()) return cached_getTargetFormatItemList(self.getBaseContentType())
def _getConversionFromProxyServer(self, format): def _getConversionFromProxyServer(self, format): # pylint: disable=redefined-builtin
""" """
Communicates with server to convert a file Communicates with server to convert a file
""" """
...@@ -226,7 +225,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -226,7 +225,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
return response_dict['mime'], Pdata(dec(response_dict['data'])) return response_dict['mime'], Pdata(dec(response_dict['data']))
# Conversion API # Conversion API
def _convert(self, format, frame=0, **kw): def _convert(self, format, frame=0, **kw): # pylint: disable=redefined-builtin
"""Convert the document to the given format. """Convert the document to the given format.
If a conversion is already stored for this format, it is returned If a conversion is already stored for this format, it is returned
...@@ -346,8 +345,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -346,8 +345,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
if zip_file is None: if zip_file is None:
format_list = [x for x in self.getTargetFormatList() format_list = [x for x in self.getTargetFormatList()
if x.startswith('html') or x.endswith('html')] if x.startswith('html') or x.endswith('html')]
format = format_list[0] mime, data = self._getConversionFromProxyServer(format_list[0])
mime, data = self._getConversionFromProxyServer(format)
archive_file = cStringIO.StringIO() archive_file = cStringIO.StringIO()
archive_file.write(str(data)) archive_file.write(str(data))
zip_file = zipfile.ZipFile(archive_file) zip_file = zipfile.ZipFile(archive_file)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>OOoDocument</string> </value> <value> <string>OOoDocument</string> </value>
...@@ -43,11 +49,7 @@ ...@@ -43,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:193, 42: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:229, 21: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:349, 6: Redefining built-in \'format\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -57,13 +59,28 @@ ...@@ -57,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -76,7 +93,7 @@ ...@@ -76,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -85,7 +102,7 @@ ...@@ -85,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -28,4 +28,7 @@ ...@@ -28,4 +28,7 @@
# for builders, and still distinguish order builders from others # for builders, and still distinguish order builders from others
# Once legacy simulation is dropped, "Order Builder" portal type should # Once legacy simulation is dropped, "Order Builder" portal type should
# should be changed to use SimulatedDeliveryBuilder class. # should be changed to use SimulatedDeliveryBuilder class.
from erp5.component.document.GeneratedDeliveryBuilder import GeneratedDeliveryBuilder as OrderBuilder from erp5.component.document.GeneratedDeliveryBuilder import GeneratedDeliveryBuilder
class OrderBuilder(GeneratedDeliveryBuilder):
pass
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>OrderBuilder</string> </value> <value> <string>OrderBuilder</string> </value>
...@@ -53,13 +59,28 @@ ...@@ -53,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -72,7 +93,7 @@ ...@@ -72,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -81,7 +102,7 @@ ...@@ -81,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
...@@ -107,4 +128,4 @@ ...@@ -107,4 +128,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
\ No newline at end of file
############################################################################## ##############################################################################
# #
# Copyright (c) 2002-2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002-2005 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -46,10 +45,19 @@ else: ...@@ -46,10 +45,19 @@ else:
from Products.ERP5Security.ERP5UserManager import ERP5UserManager from Products.ERP5Security.ERP5UserManager import ERP5UserManager
from Products.ERP5Security.ERP5LoginUserManager import ERP5LoginUserManager from Products.ERP5Security.ERP5LoginUserManager import ERP5LoginUserManager
class UserExistsError(ValidationFailed):
class UserExistsError(
ValidationFailed,
# to workaround pylint's false positive:
# Exception doesn't inherit from standard "Exception" class (nonstandard-exception)
# because it cannot import ValidationFailed (which is set by a monkey patch), we also
# inherit from Exception.
Exception,
):
def __init__(self, user_id): def __init__(self, user_id):
super(UserExistsError, self).__init__('user id %s already exists' % (user_id, )) super(UserExistsError, self).__init__('user id %s already exists' % (user_id, ))
class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMixin): class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMixin):
""" """
An Person object holds the information about An Person object holds the information about
...@@ -91,7 +99,7 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMi ...@@ -91,7 +99,7 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMi
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTitle') 'getTitle')
def getTitle(self, **kw): def getTitle(self, **kw): # pylint: disable=super-on-old-class
""" """
Returns the title if it exists or a combination of Returns the title if it exists or a combination of
first name, middle name and last name first name, middle name and last name
...@@ -105,7 +113,7 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMi ...@@ -105,7 +113,7 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin, ERP5UserMi
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTranslatedTitle') 'getTranslatedTitle')
def getTranslatedTitle(self, **kw): def getTranslatedTitle(self, **kw): # pylint: disable=super-on-old-class
""" """
Returns the title if it exists or a combination of Returns the title if it exists or a combination of
first name, middle name and last name first name, middle name and last name
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>Person</string> </value> <value> <string>Person</string> </value>
...@@ -43,11 +49,7 @@ ...@@ -43,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:158, 10: Exception doesn\'t inherit from standard "Exception" class (nonstandard-exception)</string>
<string>W:166, 6: Exception doesn\'t inherit from standard "Exception" class (nonstandard-exception)</string>
<string>W:178, 6: Exception doesn\'t inherit from standard "Exception" class (nonstandard-exception)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -57,13 +59,28 @@ ...@@ -57,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -76,7 +93,7 @@ ...@@ -76,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -85,7 +102,7 @@ ...@@ -85,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
...@@ -203,8 +202,8 @@ class SimulatedDeliveryBuilder(BuilderMixin): ...@@ -203,8 +202,8 @@ class SimulatedDeliveryBuilder(BuilderMixin):
if property_dict in (None, {}): if property_dict in (None, {}):
return return
delivery = self.getPortalObject().restrictedTraverse(delivery_relative_url) delivery = self.getPortalObject().restrictedTraverse(delivery_relative_url)
for (property, value) in property_dict.iteritems(): for (prop, value) in property_dict.iteritems():
delivery.setPropertyList(property, value) delivery.setPropertyList(prop, value)
# Try to remove existing properties/categories from Movements that # Try to remove existing properties/categories from Movements that
# should exist on Deliveries. # should exist on Deliveries.
...@@ -341,7 +340,7 @@ class SimulatedDeliveryBuilder(BuilderMixin): ...@@ -341,7 +340,7 @@ class SimulatedDeliveryBuilder(BuilderMixin):
'solveDivergence') 'solveDivergence')
solveDivergence = UnrestrictedMethod(_solveDivergence) solveDivergence = UnrestrictedMethod(_solveDivergence)
def _createDelivery(self, delivery_module, movement_list, activate_kw): def _createDelivery(self, delivery_module, movement_list, activate_kw): # pylint: disable=super-on-old-class
""" """
Refer to the docstring in GeneratedDeliveryBuilder. Refer to the docstring in GeneratedDeliveryBuilder.
Unlike GeneratedDeliveryBuilder, SimulatedDeliveryBuilder needs to respect Unlike GeneratedDeliveryBuilder, SimulatedDeliveryBuilder needs to respect
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>SimulatedDeliveryBuilder</string> </value> <value> <string>SimulatedDeliveryBuilder</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:206, 9: Redefining built-in \'property\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -10,7 +10,7 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None): ...@@ -10,7 +10,7 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None):
stdout=PIPE, stdout=PIPE,
stderr=PIPE, stderr=PIPE,
close_fds=True) close_fds=True)
output, error = process.communicate(input=data) output, _ = process.communicate(input=data)
elif barcode_type == 'ean13': elif barcode_type == 'ean13':
from hubarcode.ean13 import EAN13Encoder from hubarcode.ean13 import EAN13Encoder
encoder = EAN13Encoder(data) encoder = EAN13Encoder(data)
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>BarcodeUtils</string> </value> <value> <string>BarcodeUtils</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>extension.erp5.BarcodeUtils</string> </value> <value> <string>extension.erp5.BarcodeUtils</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,26 +98,30 @@ ...@@ -59,26 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -37,7 +37,6 @@ def migrateToEmbeddedFile(self, force=0): ...@@ -37,7 +37,6 @@ def migrateToEmbeddedFile(self, force=0):
if portal_type in ('File', 'Image') and self.getValidationState()=='embedded': if portal_type in ('File', 'Image') and self.getValidationState()=='embedded':
embedded_type = 'Embedded File' embedded_type = 'Embedded File'
container = self.getParentValue() container = self.getParentValue()
id = self.id
if force == 1: if force == 1:
changeObjectClass(container, id, getattr(erp5.portal_type, embedded_type)) changeObjectClass(container, self.id, getattr(erp5.portal_type, embedded_type))
return '%s: %s -> %s' % (self.getRelativeUrl(), portal_type, embedded_type), return '%s: %s -> %s' % (self.getRelativeUrl(), portal_type, embedded_type),
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>BaseMigration</string> </value> <value> <string>BaseMigration</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>extension.erp5.BaseMigration</string> </value> <value> <string>extension.erp5.BaseMigration</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,26 +98,30 @@ ...@@ -59,26 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -47,7 +47,7 @@ class IEncryptedPassword(Interface): ...@@ -47,7 +47,7 @@ class IEncryptedPassword(Interface):
Check if the password value is acceptable - i.e. follows site rules. Check if the password value is acceptable - i.e. follows site rules.
""" """
def setEncodedPassword(value, format='default'): def setEncodedPassword(value, format='default'): # pylint: disable=redefined-builtin
""" """
Set an already encoded password. Set an already encoded password.
""" """
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>IEncryptedPassword</string> </value> <value> <string>IEncryptedPassword</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.encrypted_password</string> </value> <value> <string>Products.ERP5.interfaces.encrypted_password</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>interface.erp5.IEncryptedPassword</string> </value> <value> <string>interface.erp5.IEncryptedPassword</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 50, 32: Redefining built-in \'format\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -77,14 +77,22 @@ class EncryptedPasswordMixin: ...@@ -77,14 +77,22 @@ class EncryptedPasswordMixin:
if not _checkPermission(Permissions.SetOwnPassword, self): if not _checkPermission(Permissions.SetOwnPassword, self):
raise AccessControl_Unauthorized('setPassword') raise AccessControl_Unauthorized('setPassword')
def _setEncodedPassword(self, value, format='default'): def _setEncodedPassword(
self,
value,
format='default', # pylint: disable=redefined-builtin
):
password = getattr(aq_base(self), 'password', None) password = getattr(aq_base(self), 'password', None)
if password is None or isinstance(password, basestring): if password is None or isinstance(password, basestring):
password = self.password = PersistentMapping() password = self.password = PersistentMapping()
self.password[format] = value self.password[format] = value
security.declarePublic('setEncodedPassword') security.declarePublic('setEncodedPassword')
def setEncodedPassword(self, value, format='default'): def setEncodedPassword(
self,
value,
format='default', # pylint: disable=redefined-builtin
):
""" """
""" """
self.checkUserCanChangePassword() self.checkUserCanChangePassword()
...@@ -121,14 +129,14 @@ class EncryptedPasswordMixin: ...@@ -121,14 +129,14 @@ class EncryptedPasswordMixin:
if password is marker: if password is marker:
password = default_password password = default_password
else: else:
format = kw.get('format', 'default') format_ = kw.get('format', 'default')
# Backward compatibility: if it's not a PersistentMapping instance, # Backward compatibility: if it's not a PersistentMapping instance,
# assume it's a monovalued string, which corresponds to default # assume it's a monovalued string, which corresponds to default
# password encoding. # password encoding.
if isinstance(password, PersistentMapping): if isinstance(password, PersistentMapping):
password = password.get(format, default_password) password = password.get(format_, default_password)
else: else:
if format != 'default': if format_ != 'default':
password = default_password password = default_password
return password return password
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>EncryptedPasswordMixin</string> </value> <value> <string>EncryptedPasswordMixin</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.encrypted_password</string> </value> <value> <string>Products.ERP5.mixin.encrypted_password</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>mixin.erp5.EncryptedPasswordMixin</string> </value> <value> <string>mixin.erp5.EncryptedPasswordMixin</string> </value>
...@@ -37,11 +49,7 @@ ...@@ -37,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 79, 39: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W: 86, 38: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:123, 6: Redefining built-in \'format\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -51,13 +59,28 @@ ...@@ -51,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -70,7 +93,7 @@ ...@@ -70,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -79,7 +102,7 @@ ...@@ -79,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -132,4 +132,4 @@ ...@@ -132,4 +132,4 @@
<portal_type id="Solver Tool"> <portal_type id="Solver Tool">
<item>Solver Type</item> <item>Solver Type</item>
</portal_type> </portal_type>
</allowed_content_type_list> </allowed_content_type_list>
\ No newline at end of file
...@@ -67,8 +67,8 @@ iban_code = ''.join([str(letter_code_dict.get(x, x)) ...@@ -67,8 +67,8 @@ iban_code = ''.join([str(letter_code_dict.get(x, x))
for x in bban + country_code + checksum]) for x in bban + country_code + checksum])
try: try:
iban_int = int(iban_code) iban_int = int(iban_code)
except ValueError: except ValueError:
return False return False
return iban_int % 97 == 1 return iban_int % 97 == 1
# this script has an `id` argument
# pylint: disable=redefined-builtin
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if id and id != context.getId(): if id and id != context.getId():
......
...@@ -23,7 +23,7 @@ if content_type == 'text/html': ...@@ -23,7 +23,7 @@ if content_type == 'text/html':
else: else:
mail_template = context.Event_viewMimeMessage mail_template = context.Event_viewMimeMessage
attachment_list = attachment_list[:] attachment_list = list(attachment_list)
for embedded_file in embedded_file_list: for embedded_file in embedded_file_list:
mime_type, content = embedded_file.getMimeTypeAndContent() mime_type, content = embedded_file.getMimeTypeAndContent()
name = embedded_file.getFilename() name = embedded_file.getFilename()
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>from_url, to_url, subject, body, content_type, attachment_list=[], embedded_file_list=[], extra_header_dict=None</string> </value> <value> <string>from_url, to_url, subject, body, content_type, attachment_list=(), embedded_file_list=(), extra_header_dict=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
# this script has an `id` argument
# pylint: disable=redefined-builtin
domain = parent.generateTempDomain(id=id) domain = parent.generateTempDomain(id=id)
domain.edit(title=title, domain.edit(title=title,
criterion_property_list=[criterion_property]) criterion_property_list=[criterion_property])
......
...@@ -3,7 +3,7 @@ if not date: ...@@ -3,7 +3,7 @@ if not date:
try: try:
now = DateTime() now = DateTime()
date = DateTime(date) date = DateTime(date)
except: except Exception:
return '' return ''
Base_translateString = context.Base_translateString Base_translateString = context.Base_translateString
diff = now - date diff = now - date
......
translateString = context.Base_translateString translateString = context.Base_translateString
request = context.REQUEST
ptype = context.getPortalType() ptype = context.getPortalType()
if not description: if not description:
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
# Assumes that 2 currencies with the same ID, they are the same currency # Assumes that 2 currencies with the same ID, they are the same currency
if from_currency is not None and to_currency is not None and \ if from_currency is not None and to_currency is not None and \
[x for x in from_currency.split('/') if x.strip()][-1] == [x for x in to_currency.split('/') if x.strip()][-1]: [x for x in from_currency.split('/') if x.strip()][-1] == [x for x in to_currency.split('/') if x.strip()][-1]:
return [1] return [1]
def sort_by_date(a, b): def sort_by_date(a, b):
if a.getStartDateRangeMin() > b.getStartDateRangeMin() : if a.getStartDateRangeMin() > b.getStartDateRangeMin() :
return -1 return -1
return 1 return 1
object = context object_ = context
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
...@@ -37,15 +37,15 @@ if to_currency is not None: ...@@ -37,15 +37,15 @@ if to_currency is not None:
if currency_exchange_type is not None: if currency_exchange_type is not None:
temp_kw['category_list'].append('currency_exchange_type/%s' % currency_exchange_type) temp_kw['category_list'].append('currency_exchange_type/%s' % currency_exchange_type)
temp_object.edit(**temp_kw) temp_object.edit(**temp_kw)
object = temp_object object_ = temp_object
mapped_value = context.portal_domains.generateMappedValue(object, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=0, has_cell_content=0,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
discount = getattr(mapped_value, 'discount', None) discount = getattr(mapped_value, 'discount', None)
if base_price is None and discount is None: if base_price is None and discount is None:
mapped_value = context.portal_domains.generateMappedValue(object, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=1, has_cell_content=1,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
...@@ -63,14 +63,14 @@ else: ...@@ -63,14 +63,14 @@ else:
if start_date is None: if start_date is None:
if getattr(context,'isDelivery',None): if getattr(context,'isDelivery',None):
start_date = context.getStartDate() start_date = context.getStartDate()
mapped_value = context.portal_domains.generateMappedValue(object, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=0, has_cell_content=0,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
base_price = getattr(mapped_value, 'base_price', None) base_price = getattr(mapped_value, 'base_price', None)
discount = getattr(mapped_value, 'discount', None) discount = getattr(mapped_value, 'discount', None)
if base_price is None and discount is None: if base_price is None and discount is None:
mapped_value = context.portal_domains.generateMappedValue(object, mapped_value = context.portal_domains.generateMappedValue(object_,
has_cell_content=1, has_cell_content=1,
validation_state='validated', validation_state='validated',
sort_method=sort_by_date) sort_method=sort_by_date)
......
...@@ -16,10 +16,10 @@ for divergence in divergence_list: ...@@ -16,10 +16,10 @@ for divergence in divergence_list:
uid = 'new_%s&%s' % (simulation_movement_url, uid = 'new_%s&%s' % (simulation_movement_url,
divergence.getProperty('tested_property')) divergence.getProperty('tested_property'))
object = portal_object.restrictedTraverse(object_relative_url) document = portal_object.restrictedTraverse(object_relative_url)
o = newTempBase(object.getParentValue(), object.getId(), uid=uid, o = newTempBase(document.getParentValue(), document.getId(), uid=uid,
message=str(divergence.getTranslatedMessage()), message=str(divergence.getTranslatedMessage()),
object_title=object.getTranslatedTitle(), object_title=document.getTranslatedTitle(),
prevision_title=prevision_title, prevision_title=prevision_title,
decision_title=decision_title, decision_title=decision_title,
candidate_list=[(context.Base_translateString('Do nothing'), 'ignore'), candidate_list=[(context.Base_translateString('Do nothing'), 'ignore'),
......
...@@ -10,14 +10,14 @@ for divergence in divergence_list: ...@@ -10,14 +10,14 @@ for divergence in divergence_list:
prop = divergence.getProperty('tested_property') prop = divergence.getProperty('tested_property')
if prop in (None, '') or divergence.getCollectOrderGroup() != 'delivery': if prop in (None, '') or divergence.getCollectOrderGroup() != 'delivery':
continue continue
message, candidate_list, value_list, decision_title_list, prevision_title_list = candidate_dict.get(prop, ['', [], [], [], []]) _, candidate_list, value_list, decision_title_list, prevision_title_list = candidate_dict.get(prop, ['', [], [], [], []])
decision_value = divergence.getProperty('decision_value') decision_value = divergence.getProperty('decision_value')
decision_title = divergence.getProperty('decision_title', decision_value) decision_title = divergence.getProperty('decision_title', decision_value)
prevision_value = divergence.getProperty('prevision_value') prevision_value = divergence.getProperty('prevision_value')
prevision_title = divergence.getProperty('prevision_title', prevision_value) prevision_title = divergence.getProperty('prevision_title', prevision_value)
object_relative_url = divergence.getProperty('object_relative_url') object_relative_url = divergence.getProperty('object_relative_url')
simulation_movement_url = divergence.getProperty('simulation_movement').getRelativeUrl() simulation_movement_url = divergence.getProperty('simulation_movement').getRelativeUrl()
object = portal_object.restrictedTraverse(object_relative_url) document = portal_object.restrictedTraverse(object_relative_url)
if decision_value not in value_list: if decision_value not in value_list:
candidate_list.append((decision_title, object_relative_url)) candidate_list.append((decision_title, object_relative_url))
value_list.append(decision_value) value_list.append(decision_value)
...@@ -32,11 +32,11 @@ for divergence in divergence_list: ...@@ -32,11 +32,11 @@ for divergence in divergence_list:
for prop, candidate_list in candidate_dict.items(): for prop, candidate_list in candidate_dict.items():
uid = 'new_%s' % prop uid = 'new_%s' % prop
object = context document = context
o = newTempBase(context.getParentValue(), context.getId(), uid, uid=uid, o = newTempBase(context.getParentValue(), context.getId(), uid, uid=uid,
message=candidate_list[0], message=candidate_list[0],
object_title=object.getTranslatedTitle(), object_title=document.getTranslatedTitle(),
decision_title=', '.join([str(x) for x in candidate_list[3]]), decision_title=', '.join([str(x) for x in candidate_list[3]]),
prevision_title=', '.join([str(x) for x in candidate_list[4]]), prevision_title=', '.join([str(x) for x in candidate_list[4]]),
candidate_list=[(context.Base_translateString('Do nothing'), 'ignore')]+candidate_list[1]) candidate_list=[(context.Base_translateString('Do nothing'), 'ignore')]+candidate_list[1])
......
...@@ -17,11 +17,11 @@ for divergence in divergence_list: ...@@ -17,11 +17,11 @@ for divergence in divergence_list:
uid = 'new_%s&%s' % (simulation_movement_url, uid = 'new_%s&%s' % (simulation_movement_url,
divergence.getProperty('tested_property')) divergence.getProperty('tested_property'))
object = portal_object.restrictedTraverse(object_relative_url) document = portal_object.restrictedTraverse(object_relative_url)
o = newTempBase(object.getParentValue(), object.getId(), uid=uid, o = newTempBase(document.getParentValue(), document.getId(), uid=uid,
message=str(divergence.getTranslatedMessage()), message=str(divergence.getTranslatedMessage()),
object_portal_type=object.getTranslatedPortalType(), object_portal_type=document.getTranslatedPortalType(),
object_title=object.getTranslatedTitle(), object_title=document.getTranslatedTitle(),
prevision_title=prevision_title, prevision_title=prevision_title,
decision_title=decision_title, decision_title=decision_title,
candidate_list=[(context.Base_translateString('Do nothing'), 'ignore'), candidate_list=[(context.Base_translateString('Do nothing'), 'ignore'),
......
# coding: utf-8
translateString = context.Base_translateString translateString = context.Base_translateString
request = context.REQUEST request = context.REQUEST
...@@ -94,7 +95,6 @@ def getTaxLineList(order): ...@@ -94,7 +95,6 @@ def getTaxLineList(order):
return tax_line_list return tax_line_list
line_base_contribution_list = [] line_base_contribution_list = []
number = 0
tax_free_line_totalprice = 0 tax_free_line_totalprice = 0
line_list = [] line_list = []
line_not_tax = [] line_not_tax = []
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
""" """
This script provides a facility to permit conversion by format. This script provides a facility to permit conversion by format.
""" """
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
"""Just an alias for real script """Just an alias for real script
""" """
from Products.ERP5Type.Log import log from Products.ERP5Type.Log import log
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
""" """
This script returns a standard file name, build from reference, version and This script returns a standard file name, build from reference, version and
language (this is only the base part of the name, the extension should be appended language (this is only the base part of the name, the extension should be appended
......
""" """
WARNING: this script requires proxy manager WARNING: this script requires proxy manager
This script tries to acquire category values from other objects This script tries to acquire category values from other documents
base_category_list - list of category values we need to retrieve base_category_list - list of category values we need to retrieve
object - object which we want to assign roles to. obj - document which we want to assign roles to.
""" """
category_dict = {} category_dict = {}
if object is None: if obj is None:
return [] return []
for base_category in base_category_list: for base_category in base_category_list:
if base_category == 'parent': if base_category == 'parent':
o_list = [object.getParentValue()] o_list = [obj.getParentValue()]
else: else:
o_list = object.getValueList(base_category) o_list = obj.getValueList(base_category)
for o in o_list: for o in o_list:
for user, role_list in o.get_local_roles(): for user, role_list in o.get_local_roles():
for role in role_list: for role in role_list:
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -64,13 +64,12 @@ if download or not use_activity: ...@@ -64,13 +64,12 @@ if download or not use_activity:
if not from_url: if not from_url:
raise ValueError('Preferred Event Sender Email not configured') raise ValueError('Preferred Event Sender Email not configured')
# Return-Path # Return-Path (TODO)
if reply_url is None: if reply_url is None:
reply_url = portal.portal_preferences.getPreferredEventSenderEmail() reply_url = portal.portal_preferences.getPreferredEventSenderEmail()
additional_headers = None additional_headers = None # pylint: disable=unused-variable
if reply_url: if reply_url:
additional_headers = {'Return-Path':reply_url} additional_headers = {'Return-Path':reply_url}
content_type = context.getContentType() content_type = context.getContentType()
mail_message = context.Base_createMailMessageAsString( mail_message = context.Base_createMailMessageAsString(
......
# this script can be overridden as you wish. # this script can be overridden as you wish.
pass
...@@ -8,7 +8,7 @@ for career_step in all_career_step_list : ...@@ -8,7 +8,7 @@ for career_step in all_career_step_list :
career_step.getSubordination() == subordination_relative_url) and \ career_step.getSubordination() == subordination_relative_url) and \
career_step.getStartDate() and \ career_step.getStartDate() and \
career_step.getValidationState() not in ('cancelled', 'deleted'): career_step.getValidationState() not in ('cancelled', 'deleted'):
career_step_list.append(career_step) career_step_list.append(career_step)
# sort them by start date # sort them by start date
career_step_list.sort(key=lambda x: x.getStartDate()) career_step_list.sort(key=lambda x: x.getStartDate())
......
from Products.PythonScripts.standard import Object from Products.PythonScripts.standard import Object
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ERP5Type.DateUtils import atTheEndOfPeriod from Products.ERP5Type.DateUtils import atTheEndOfPeriod
request = container.REQUEST request = container.REQUEST
from_date = request.get('from_date', None) from_date = request.get('from_date', None)
...@@ -8,10 +7,10 @@ aggregation_level = request.get('aggregation_level', None) ...@@ -8,10 +7,10 @@ aggregation_level = request.get('aggregation_level', None)
portal = context.getPortalObject() portal = context.getPortalObject()
module_list = [] module_list = []
for module_id in portal.objectIds(spec=('ERP5 Folder',)): for module_id in portal.objectIds(spec=('ERP5 Folder',)):
module = portal.restrictedTraverse(module_id, None) module = portal.restrictedTraverse(module_id, None)
if module is not None: if module is not None:
if portal.portal_membership.checkPermission('View', module): if portal.portal_membership.checkPermission('View', module):
module_list.append(module) module_list.append(module)
module_list.sort(key=lambda x: x.getTitle()) module_list.sort(key=lambda x: x.getTitle())
# build document portal type list # build document portal type list
...@@ -69,25 +68,25 @@ line_list = [] ...@@ -69,25 +68,25 @@ line_list = []
append = line_list.append append = line_list.append
period_count_dict = {} period_count_dict = {}
for portal_type in portal_type_list: for portal_type in portal_type_list:
if portal_type_count_dict.has_key(portal_type): if portal_type_count_dict.has_key(portal_type):
period_count = portal_type_count_dict[portal_type] period_count = portal_type_count_dict[portal_type]
obj = Object(uid="new_") obj = Object(uid="new_")
obj["document_type"] = context.Base_translateString(portal_type) obj["document_type"] = context.Base_translateString(portal_type)
else: else:
continue continue
line_counter = 0 line_counter = 0
for period in period_list: for period in period_list:
if period_count.has_key(period): if period_count.has_key(period):
obj[period] = period_count[period] obj[period] = period_count[period]
line_counter += period_count[period] line_counter += period_count[period]
if period_count_dict.has_key(period): if period_count_dict.has_key(period):
period_count_dict[period] = period_count_dict[period] + period_count[period] period_count_dict[period] = period_count_dict[period] + period_count[period]
else:
period_count_dict[period] = period_count[period]
else: else:
obj[period] = 0 period_count_dict[period] = period_count[period]
obj['total'] = line_counter else:
append(obj) obj[period] = 0
obj['total'] = line_counter
append(obj)
# sort lines # sort lines
def cmpType(a, b): def cmpType(a, b):
......
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ERP5Type.DateUtils import atTheEndOfPeriod from Products.ERP5Type.DateUtils import atTheEndOfPeriod
request = container.REQUEST request = container.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
......
...@@ -28,7 +28,7 @@ for assignment in context.contentValues(portal_type='Assignment'): ...@@ -28,7 +28,7 @@ for assignment in context.contentValues(portal_type='Assignment'):
and assignment.getValidationState() == 'open' \ and assignment.getValidationState() == 'open' \
and ( assignment.getStartDate() is None or and ( assignment.getStartDate() is None or
assignment.getStartDate() <= now <= assignment.getStopDate()): assignment.getStartDate() <= now <= assignment.getStopDate()):
existing_group_set[assignment.getGroup()] = 1 existing_group_set[assignment.getGroup()] = 1
# If we have multiple groups defined on assignments, this scripts does not # If we have multiple groups defined on assignments, this scripts does not
# try to guess, and fallback to the default career's group # try to guess, and fallback to the default career's group
......
...@@ -2,7 +2,6 @@ from Products.CMFActivity.Errors import ActivityPendingError ...@@ -2,7 +2,6 @@ from Products.CMFActivity.Errors import ActivityPendingError
Base_translateString = context.Base_translateString Base_translateString = context.Base_translateString
person = context person = context
career_list = []
default_career = None default_career = None
if 'default_career' in person.objectIds(): if 'default_career' in person.objectIds():
......
request = container.REQUEST request = container.REQUEST
RESPONSE = request.RESPONSE
stat_line = request.get('stat_line', None) stat_line = request.get('stat_line', None)
return stat_line return stat_line
# XXX example of another way to get the stat line but this is slower
from Products.ERP5Type.Log import log
from Products.PythonScripts.standard import Object
from Products.ZSQLCatalog.SQLCatalog import Query
request = container.REQUEST
from_date = request.get('from_date', None)
to_date = request.get('at_date', None)
aggregation_level = request.get('aggregation_level', None)
log("in stat method", "")
# build document portal type list
portal_type_list = []
extend = portal_type_list.extend
for title, path in context.ERP5Site_getModuleItemList():
document_type_list = context.restrictedTraverse(path).allowedContentTypes()
extend([x.id for x in document_type_list])
# compute sql params, we group and order by date and portal type
if aggregation_level == "year":
sql_format = "%Y"
elif aggregation_level == "month":
sql_format = "%Y-%m"
elif aggregation_level == "week":
sql_format = "%Y-%u"
elif aggregation_level == "day":
sql_format = "%Y-%m-%d"
count_kw = {}
if from_date is not None and to_date is not None:
count_kw['creation_date'] = {
'range': 'minngt',
'query': (from_date, to_date),
}
elif from_date is not None:
count_kw['creation_date'] = {
'range': 'min',
'query': from_date,
}
elif to_date is not None:
count_kw['creation_date'] = {
'range': 'ngt',
'query': to_date,
}
# count number of object created by the user for each type of document
result_list = context.portal_catalog.countResults(select_dict={'date': 'DATE_FORMAT(creation_date, "%s")' % sql_format},
portal_type=portal_type_list,limit=None,
owner=context.Person_getUserId(),
group_by=['DATE_FORMAT(creation_date, "%s")' % sql_format],
**count_kw)
# build result dict per portal_type then period
period_count_dict = {}
for result in result_list:
period_count_dict[result[1]] = result[0]
# build line
obj = Object(uid="new_")
obj["document_type"] = 'Total'
line_counter = 0
for period in period_list:
if period_count_dict.has_key(period):
obj[period] = period_count_dict[period]
line_counter += period_count_dict[period]
else:
obj[period] = 0
obj['total'] = line_counter
return [obj,]
...@@ -14,9 +14,8 @@ context.setMembershipCriterionCategoryList(membership_list) ...@@ -14,9 +14,8 @@ context.setMembershipCriterionCategoryList(membership_list)
context.setResourceValue(context.getParentValue()) context.setResourceValue(context.getParentValue())
context.setMappedValuePropertyList(('base_price','discount')) context.setMappedValuePropertyList(('base_price','discount'))
if cell_range_key_list != [[None, None]] : if cell_range_key_list != [[None, None]] :
i = 0
for k in cell_range_key_list: for k in cell_range_key_list:
category_list = filter(lambda k_item: k_item is not None, k) category_list = [k_item for k_item in k if k is not None]
c = context.newCell(*k, **kwd) c = context.newCell(*k, **kwd)
c.edit(mapped_value_property_list = ('base_price','discount'), c.edit(mapped_value_property_list = ('base_price','discount'),
force_update = 1, force_update = 1,
......
...@@ -13,8 +13,7 @@ if listbox is not None: ...@@ -13,8 +13,7 @@ if listbox is not None:
for k, v in listbox.items(): for k, v in listbox.items():
object_url = v['choice'] object_url = v['choice']
if object_url != 'ignore': if object_url != 'ignore':
object = delivery.restrictedTraverse(object_url) delivery_solve_property_dict[k] = delivery.restrictedTraverse(object_url).getPropertyList(k)
delivery_solve_property_dict[k] = object.getPropertyList(k)
divergence_to_accept_list = [] divergence_to_accept_list = []
divergence_to_adopt_list = [] divergence_to_adopt_list = []
...@@ -22,8 +21,7 @@ divergence_to_adopt_list = [] ...@@ -22,8 +21,7 @@ divergence_to_adopt_list = []
divergence_dict = {} divergence_dict = {}
for divergence in divergence_list: for divergence in divergence_list:
simulation_movement_url = divergence.getProperty('simulation_movement').getRelativeUrl() simulation_movement_url = divergence.getProperty('simulation_movement').getRelativeUrl()
property = divergence.getProperty('tested_property') divergence_dict['%s&%s' % (simulation_movement_url, divergence.getProperty('tested_property'))] = divergence
divergence_dict['%s&%s' % (simulation_movement_url, property)] = divergence
for listbox in [state_change['kwargs'].get('line_group_listbox'), for listbox in [state_change['kwargs'].get('line_group_listbox'),
state_change['kwargs'].get('cell_group_listbox')]: state_change['kwargs'].get('cell_group_listbox')]:
......
...@@ -3,8 +3,6 @@ delivery = state_change['object'] ...@@ -3,8 +3,6 @@ delivery = state_change['object']
stop_date = state_change.kwargs['stop_date'] stop_date = state_change.kwargs['stop_date']
start_date = state_change.kwargs['start_date'] start_date = state_change.kwargs['start_date']
tag = delivery.getPath() + '_split'
split_and_defer = 0
listbox = state_change['kwargs'].get('listbox') listbox = state_change['kwargs'].get('listbox')
split_movement_list = [] split_movement_list = []
if listbox is not None: if listbox is not None:
......
...@@ -19,10 +19,10 @@ delivery.activate(after_tag=tag).updateCausalityState() ...@@ -19,10 +19,10 @@ delivery.activate(after_tag=tag).updateCausalityState()
# Create delivery # Create delivery
explanation_uid_list = [] explanation_uid_list = []
object = delivery object_ = delivery
while object is not None: while object_ is not None:
explanation_uid_list.append(object.getUid()) explanation_uid_list.append(object_.getUid())
object = object.getCausalityValue() object_ = object_.getCausalityValue()
previous_tag = None previous_tag = None
for delivery_builder in delivery.getBuilderList(): for delivery_builder in delivery.getBuilderList():
......
delivery = state_change['object'] delivery = state_change['object']
portal = delivery.getPortalObject() portal = delivery.getPortalObject()
try: if not (hasattr(portal, 'portal_solvers') and hasattr(portal, 'portal_solver_processes')):
portal.portal_solvers
portal.portal_solver_processes
except AttributeError:
delivery.diverge() delivery.diverge()
else: else:
solver_tag = '%s_solve' % delivery.getPath() solver_tag = '%s_solve' % delivery.getPath()
......
...@@ -7,12 +7,12 @@ catalog. ...@@ -7,12 +7,12 @@ catalog.
""" """
from Products.ERP5Type.Log import log from Products.ERP5Type.Log import log
object = sci['object'] document = sci['object']
portal = object.getPortalObject() portal = document.getPortalObject()
translateString = portal.Base_translateString translateString = portal.Base_translateString
# Get the owner # Get the owner
owner = object.getViewPermissionOwner() owner = document.getViewPermissionOwner()
owner_value = portal.Base_getUserValueByUserId(owner) owner_value = portal.Base_getUserValueByUserId(owner)
# Get the authenticated user # Get the authenticated user
...@@ -43,11 +43,11 @@ Answer: ...@@ -43,11 +43,11 @@ Answer:
${answer} ${answer}
""" """
msg = translateString(msg, msg = translateString(msg,
mapping=dict(id=object.getId(), mapping=dict(id=document.getId(),
subject=subject, subject=subject,
user=user_value.getTitle(), user=user_value.getTitle(),
question=object.getDescription(), question=document.getDescription(),
answer=object.getTextContent()) answer=document.getTextContent())
) )
# We can now notify the owner through the notification tool # We can now notify the owner through the notification tool
......
...@@ -111,4 +111,4 @@ Variant Movement Group | view ...@@ -111,4 +111,4 @@ Variant Movement Group | view
Variation Property Movement Group | view Variation Property Movement Group | view
portal_actions | jump_query portal_actions | jump_query
portal_actions | jump_related_object portal_actions | jump_related_object
portal_actions | post_query portal_actions | post_query
\ No newline at end of file
...@@ -88,4 +88,4 @@ Person | Link ...@@ -88,4 +88,4 @@ Person | Link
Person | Telephone Person | Telephone
Query Module | Query Query Module | Query
Rounding Tool | Rounding Model Rounding Tool | Rounding Model
Solver Tool | Solver Type Solver Tool | Solver Type
\ No newline at end of file
...@@ -63,4 +63,4 @@ Split Movement Group ...@@ -63,4 +63,4 @@ Split Movement Group
Telephone Telephone
Title Movement Group Title Movement Group
Variant Movement Group Variant Movement Group
Variation Property Movement Group Variation Property Movement Group
\ No newline at end of file
...@@ -115,7 +115,7 @@ class PDFDocument(Image): ...@@ -115,7 +115,7 @@ class PDFDocument(Image):
return outputStream.getvalue() return outputStream.getvalue()
# Conversion API # Conversion API
def _convert(self, format, **kw): def _convert(self, format, **kw): # pylint: disable=redefined-builtin
""" """
Implementation of conversion for PDF files Implementation of conversion for PDF files
""" """
...@@ -164,7 +164,7 @@ class PDFDocument(Image): ...@@ -164,7 +164,7 @@ class PDFDocument(Image):
raise NotImplementedError raise NotImplementedError
security.declarePrivate('_convertToText') security.declarePrivate('_convertToText')
def _convertToText(self): def _convertToText(self, format='txt'): # pylint: disable=redefined-builtin
""" """
Convert the PDF text content to text with pdftotext Convert the PDF text content to text with pdftotext
""" """
...@@ -346,9 +346,9 @@ class PDFDocument(Image): ...@@ -346,9 +346,9 @@ class PDFDocument(Image):
self._content_information = result self._content_information = result
return result.copy() return result.copy()
def _setFile(self, data, precondition=None): def _setFile(self, *args, **kw):
try: try:
del self._content_information del self._content_information
except (AttributeError, KeyError): except (AttributeError, KeyError):
pass pass
Image._setFile(self, data, precondition=precondition) Image._setFile(self, *args, **kw)
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>PDFDocument</string> </value> <value> <string>PDFDocument</string> </value>
...@@ -43,11 +49,7 @@ ...@@ -43,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:117, 21: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:166, 2: Arguments number differs from overridden \'_convertToText\' method (arguments-differ)</string>
<string>W:348, 2: Arguments number differs from overridden \'_setFile\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -57,13 +59,28 @@ ...@@ -57,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -76,7 +93,7 @@ ...@@ -76,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -85,7 +102,7 @@ ...@@ -85,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -71,7 +71,7 @@ def mkProxy(self): ...@@ -71,7 +71,7 @@ def mkProxy(self):
sp = xmlrpclib.ServerProxy('http://%s:%d' % (adr,nr), allow_none=True) sp = xmlrpclib.ServerProxy('http://%s:%d' % (adr,nr), allow_none=True)
return sp return sp
def generateFile(self, name, data, format): def generateFile(self, name, data, format): # pylint: disable=redefined-builtin
sp = mkProxy(self) sp = mkProxy(self)
kw = sp.run_generate(name, data, None, format) kw = sp.run_generate(name, data, None, format)
res = base64.decodestring(kw['data']) res = base64.decodestring(kw['data'])
...@@ -92,7 +92,7 @@ def getLastWorkflowDate(self, state_name='simulation_state', state=('released',' ...@@ -92,7 +92,7 @@ def getLastWorkflowDate(self, state_name='simulation_state', state=('released','
or JP says "there is an API for it" and we trash this one''' or JP says "there is an API for it" and we trash this one'''
if not hasattr(self, 'workflow_history'): if not hasattr(self, 'workflow_history'):
return None return None
for name,wflow in self.workflow_history.items(): for wflow in self.workflow_history.values():
if wflow is None or len(wflow) == 0: continue # empty history if wflow is None or len(wflow) == 0: continue # empty history
if wflow[0].get(state_name) is None: continue # not the right one if wflow[0].get(state_name) is None: continue # not the right one
for i in range(len(wflow)): for i in range(len(wflow)):
...@@ -110,7 +110,7 @@ def findAddress(txt): ...@@ -110,7 +110,7 @@ def findAddress(txt):
""" """
find email address in a string find email address in a string
""" """
validchars='0-9A-Za-z.\-_' validchars = r'0-9A-Za-z.\-_'
r=re.compile('[%s]+@[%s]+' % (validchars,validchars)) r=re.compile('[%s]+@[%s]+' % (validchars,validchars))
m=r.search(txt) m=r.search(txt)
return m and m.group() return m and m.group()
...@@ -121,7 +121,7 @@ def extractParams(txt): ...@@ -121,7 +121,7 @@ def extractParams(txt):
We assume that parameters are given as lines of the format: We assume that parameters are given as lines of the format:
name:value name:value
""" """
r=re.compile('^([\w_]+):([\w_/]+)$') r = re.compile(r'^([\w_]+):([\w_/]+)$')
res=[] res=[]
for line in txt.split(): for line in txt.split():
found=r.findall(line.strip()) found=r.findall(line.strip())
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>DocumentManagement</string> </value> <value> <string>DocumentManagement</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>extension.erp5.DocumentManagement</string> </value> <value> <string>extension.erp5.DocumentManagement</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,26 +98,30 @@ ...@@ -59,26 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
############################################################################## ##############################################################################
def getPersonRoleList(self, person, object): def getPersonRoleList(self, person, object): # pylint: disable=redefined-builtin
""" """
Get list of local roles for user. Get list of local roles for user.
""" """
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>DocumentSecurity</string> </value> <value> <string>DocumentSecurity</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>extension.erp5.DocumentSecurity</string> </value> <value> <string>extension.erp5.DocumentSecurity</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,26 +98,30 @@ ...@@ -59,26 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -27,7 +27,7 @@ for frequency_reference, creation_date in date_dict.items(): ...@@ -27,7 +27,7 @@ for frequency_reference, creation_date in date_dict.items():
max_in_activities = 1000 max_in_activities = 1000
offset = 0 offset = 0
loop = documents_to_update / max_in_activities loop = documents_to_update / max_in_activities
for i in range(loop): for _ in range(loop):
limit = '%s,%s' % (offset, max_in_activities) limit = '%s,%s' % (offset, max_in_activities)
sql_kw['limit'] = limit sql_kw['limit'] = limit
updateDocumentList(**sql_kw) updateDocumentList(**sql_kw)
......
...@@ -6,5 +6,4 @@ if I don't have permissions to access the object) ...@@ -6,5 +6,4 @@ if I don't have permissions to access the object)
object_list = context.Base_getRelatedObjectValueList(base_category, portal_type_list) object_list = context.Base_getRelatedObjectValueList(base_category, portal_type_list)
title_list = [o.getTitle() for o in object_list] title_list = [o.getTitle() for o in object_list]
return [t for t in title_list if t != '']
return filter(lambda t:t!='', title_list)
...@@ -10,8 +10,8 @@ nr_of_types = len(type_list) ...@@ -10,8 +10,8 @@ nr_of_types = len(type_list)
basecatdict = {} basecatdict = {}
for type in type_list: for type_info in type_list:
type_base_cat_list = context.portal_types[type].getInstanceBaseCategoryList() type_base_cat_list = context.portal_types[type_info].getInstanceBaseCategoryList()
for base_cat in type_base_cat_list: for base_cat in type_base_cat_list:
basecatdict[base_cat] = basecatdict.setdefault(base_cat, 0)+1 basecatdict[base_cat] = basecatdict.setdefault(base_cat, 0)+1
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
""" """
Generic method to handle conversion failures ans still return something to use Generic method to handle conversion failures ans still return something to use
to explain what when wrong, etc. to explain what when wrong, etc.
......
...@@ -12,8 +12,7 @@ version of each of them. ...@@ -12,8 +12,7 @@ version of each of them.
# Document_getSimilarityCloud = Document_get + upperCase(cloud) + ValueList # Document_getSimilarityCloud = Document_get + upperCase(cloud) + ValueList
# BG - not much use, they're too different # BG - not much use, they're too different
from Products.ERP5Type.Utils import convertToUpperCase, convertToMixedCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Log import log
def getRelatedLatest(category): def getRelatedLatest(category):
funcname = 'get%sValueList' % convertToUpperCase(category) funcname = 'get%sValueList' % convertToUpperCase(category)
...@@ -44,5 +43,4 @@ if relation_id == 'all': ...@@ -44,5 +43,4 @@ if relation_id == 'all':
dic[obj] = None dic[obj] = None
return dic.keys() return dic.keys()
log('Relation %s is not provided for in this script' % relation)
return [] # failover - undefined relation return [] # failover - undefined relation
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
def cached_DMSGetItemList(base_category): def cached_DMSGetItemList(base_category):
basecatobject = context.portal_categories.resolveCategory(base_category) basecatobject = context.portal_categories.resolveCategory(base_category)
return basecatobject.getCategoryChildLogicalPathItemList() return basecatobject.getCategoryChildLogicalPathItemList()
cached_DMSGetItemList = CachingMethod(cached_DMSGetItemList, id='DMGetItemListCachedMethodWhatever') cached_DMSGetItemList = CachingMethod(cached_DMSGetItemList, id='DMGetItemListCachedMethodWhatever')
...@@ -26,7 +26,6 @@ if default_sub_field_property_dict is None: ...@@ -26,7 +26,6 @@ if default_sub_field_property_dict is None:
} }
sub_field_dict = {} sub_field_dict = {}
maximum_list_size = 5
default_sub_field_property_dict['field_type'] = 'ListField' default_sub_field_property_dict['field_type'] = 'ListField'
default_sub_field_property_dict['size'] = 1 default_sub_field_property_dict['size'] = 1
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
in such way that it is possible to select multiple in such way that it is possible to select multiple
group categories for the same document group categories for the same document
""" """
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Initialise result # Initialise result
sub_field_list = [] sub_field_list = []
...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({ ...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({
}) })
z = 0 z = 0
for i in range(1): for _ in range(1):
new_dict = default_sub_field_property_dict.copy() new_dict = default_sub_field_property_dict.copy()
new_dict['title'] = '&nbsp;' new_dict['title'] = '&nbsp;'
new_dict['key'] = str(z) new_dict['key'] = str(z)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
in such way that it is possible to select multiple in such way that it is possible to select multiple
function categories for the same document function categories for the same document
""" """
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Initialise result # Initialise result
sub_field_list = [] sub_field_list = []
...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({ ...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({
}) })
z = 0 z = 0
for i in range(1): for _ in range(1):
new_dict = default_sub_field_property_dict.copy() new_dict = default_sub_field_property_dict.copy()
new_dict['title'] = '&nbsp;' new_dict['title'] = '&nbsp;'
new_dict['key'] = str(z) new_dict['key'] = str(z)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
in such way that it is possible to select multiple in such way that it is possible to select multiple
site categories for the same document site categories for the same document
""" """
if default_sub_field_property_dict is None:
default_sub_field_property_dict = {}
# Initialise result # Initialise result
sub_field_list = [] sub_field_list = []
...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({ ...@@ -16,7 +18,7 @@ default_sub_field_property_dict.update({
}) })
z = 0 z = 0
for i in range(1): for _ in range(1):
new_dict = default_sub_field_property_dict.copy() new_dict = default_sub_field_property_dict.copy()
new_dict['title'] = '&nbsp;' new_dict['title'] = '&nbsp;'
new_dict['key'] = str(z) new_dict['key'] = str(z)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -19,8 +19,6 @@ if context.getExternalProcessingState() not in ('converted', 'empty'): ...@@ -19,8 +19,6 @@ if context.getExternalProcessingState() not in ('converted', 'empty'):
message = 'Socket Error: %s' % (repr(e) or 'undefined.') message = 'Socket Error: %s' % (repr(e) or 'undefined.')
except Exception, e: except Exception, e:
message = 'Problem: %s' % (repr(e) or 'undefined.') message = 'Problem: %s' % (repr(e) or 'undefined.')
except:
message = 'Problem: unknown'
# reach here, then exception was raised, message must be logged in workflow # reach here, then exception was raised, message must be logged in workflow
# do not simply raise but rather change external processing state # do not simply raise but rather change external processing state
# so user will see something is wrong # so user will see something is wrong
......
...@@ -11,8 +11,6 @@ except ConversionError, e: ...@@ -11,8 +11,6 @@ except ConversionError, e:
message = 'Conversion Error: %s' % (str(e) or 'undefined.') message = 'Conversion Error: %s' % (str(e) or 'undefined.')
except Exception, e: except Exception, e:
message = 'Problem: %s' % (repr(e) or 'undefined.') message = 'Problem: %s' % (repr(e) or 'undefined.')
except:
message = 'Problem: unknown'
# reach here, then exception was raised, message must be logged in workflow # reach here, then exception was raised, message must be logged in workflow
# do not simply raise but rather change external processing state # do not simply raise but rather change external processing state
......
# this script has an `file` argument
# pylint: disable=redefined-builtin
""" """
This script is called when a file is uploaded to an object via ERP5 standard interface. This script is called when a file is uploaded to an object via ERP5 standard interface.
It does the following: It does the following:
...@@ -9,9 +11,9 @@ Otherwise it just uploads the file, bumps up revision number and calls metadata ...@@ -9,9 +11,9 @@ Otherwise it just uploads the file, bumps up revision number and calls metadata
""" """
from Products.ERP5Type.Log import log, WARNING from Products.ERP5Type.Log import log, WARNING
from Products.ERP5Type.Message import translateString
translate = context.Base_translateString translate = context.Base_translateString
request = context.REQUEST
current_type = context.getPortalType() current_type = context.getPortalType()
file_name = file.filename file_name = file.filename
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
only the group the user is directly assigned to (not the whole group hierarchy path). only the group the user is directly assigned to (not the whole group hierarchy path).
""" """
return context.ERP5Type_getSecurityCategoryFromAssignmentTree(base_category_list, user_name, object, portal_type, strict=True) return context.ERP5Type_getSecurityCategoryFromAssignmentTree(base_category_list, user_name, obj, portal_type, strict=True)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type, strict=False, root=False</string> </value> <value> <string>base_category_list, user_name, obj, portal_type, strict=False, root=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -5,7 +5,7 @@ of the document (e.g. in Memo type). ...@@ -5,7 +5,7 @@ of the document (e.g. in Memo type).
from Products.ERP5Type.Log import log from Products.ERP5Type.Log import log
category_list = [] category_list = []
for ob in object.getDestinationValueList(): for ob in obj.getDestinationValueList():
category_dict = {} category_dict = {}
for base_category in base_category_list: for base_category in base_category_list:
if base_category == 'group': if base_category == 'group':
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -6,7 +6,7 @@ is addressed to (destination). Can be multiple destination persons. ...@@ -6,7 +6,7 @@ is addressed to (destination). Can be multiple destination persons.
category_list = [] category_list = []
# We look for valid assignments of destination users # We look for valid assignments of destination users
for person_object in object.getDestinationValueList(portal_type='Person'): for person_object in obj.getDestinationValueList(portal_type='Person'):
for assignment in person_object.contentValues(filter={'portal_type': 'Assignment'}): for assignment in person_object.contentValues(filter={'portal_type': 'Assignment'}):
if assignment.getValidationState() == 'open': if assignment.getValidationState() == 'open':
category_dict = {} category_dict = {}
...@@ -18,7 +18,7 @@ for person_object in object.getDestinationValueList(portal_type='Person'): ...@@ -18,7 +18,7 @@ for person_object in object.getDestinationValueList(portal_type='Person'):
if category_value not in (None, ''): if category_value not in (None, ''):
category_dict[base_category] = category_value category_dict[base_category] = category_value
else: else:
raise RuntimeError, "Error: '%s' property is required in order to update person security group" % (base_category) raise RuntimeError("Error: '%s' property is required in order to update person security group" % (base_category))
category_list.append(category_dict) category_list.append(category_dict)
return category_list return category_list
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -8,10 +8,8 @@ Person, just take from the object. ...@@ -8,10 +8,8 @@ Person, just take from the object.
category_list = [] category_list = []
person_object = object
# We look for valid assignments of this user # We look for valid assignments of this user
for assignment in person_object.contentValues(filter={'portal_type': 'Assignment'}): for assignment in obj.contentValues(filter={'portal_type': 'Assignment'}):
if assignment.getValidationState() == 'open': if assignment.getValidationState() == 'open':
category_dict = {} category_dict = {}
for base_category in base_category_list: for base_category in base_category_list:
...@@ -22,7 +20,7 @@ for assignment in person_object.contentValues(filter={'portal_type': 'Assignment ...@@ -22,7 +20,7 @@ for assignment in person_object.contentValues(filter={'portal_type': 'Assignment
if category_value not in (None, ''): if category_value not in (None, ''):
category_dict[base_category] = category_value category_dict[base_category] = category_value
else: else:
raise RuntimeError, "Error: '%s' property is required in order to update person security group" % (base_category) raise RuntimeError("Error: '%s' property is required in order to update person security group" % (base_category))
category_list.append(category_dict) category_list.append(category_dict)
return category_list return category_list
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -6,4 +6,4 @@ in the certain organisation - for this, all we need is the first part ...@@ -6,4 +6,4 @@ in the certain organisation - for this, all we need is the first part
of the group category. of the group category.
""" """
return context.ERP5Type_getSecurityCategoryFromAssignmentTree(base_category_list, user_name, object, portal_type, strict=True, root=True) return context.ERP5Type_getSecurityCategoryFromAssignmentTree(base_category_list, user_name, obj, portal_type, strict=True, root=True)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, object, portal_type</string> </value> <value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -4,5 +4,11 @@ if brain.getValidationState() == 'embedded': ...@@ -4,5 +4,11 @@ if brain.getValidationState() == 'embedded':
reference = brain.getId() reference = brain.getId()
else: else:
reference = brain.getReference() reference = brain.getReference()
format = context.getPortalObject().portal_preferences.getPreferredImageFormat()
return unicode("javascript:SelectFile('%s?format=%s')" % (reference.replace("'", "\\'"), format), 'utf-8') return unicode(
"javascript:SelectFile('%s?format=%s')" % (
reference.replace("'", "\\'"),
context.getPortalObject().portal_preferences.getPreferredImageFormat()
),
'utf-8',
)
# this script has an `format` argument
# pylint: disable=redefined-builtin
if format in ('svg',): if format in ('svg',):
image_pixels = context.getHeight()* context.getWidth() image_pixels = context.getHeight()* context.getWidth()
max_pixels = 128*128 # default thumbnail size max_pixels = 128*128 # default thumbnail size
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
""" """
Convert Image (context) to a desired format and return as a binary `filename` file. Convert Image (context) to a desired format and return as a binary `filename` file.
Requires format and desired filename (adds extension if missing). Requires format and desired filename (adds extension if missing).
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
""" """
Convert OOoDocument (context) to a desired format and return as a binary `filename` file. Convert OOoDocument (context) to a desired format and return as a binary `filename` file.
Requires format and desired filename (adds extension if missing). Requires format and desired filename (adds extension if missing).
......
# this script has an `format` argument
# pylint: disable=redefined-builtin
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST
if format in VALID_IMAGE_FORMAT_LIST: if format in VALID_IMAGE_FORMAT_LIST:
......
content_information = context.getContentInformation() content_information = context.getContentInformation()
number_of_pages = int(content_information.get('Pages', 1)) number_of_pages = int(content_information.get('Pages', 1))
max = number_of_pages - 1 max_ = number_of_pages - 1
selection_index = int(selection_index) selection_index = int(selection_index)
if selection_index > max: if selection_index > max_:
return max return max_
elif -max > selection_index: elif -max_ > selection_index:
return 0 return 0
elif selection_index < 0: elif selection_index < 0:
return max + selection_index + 1 return max_ + selection_index + 1
else: else:
return selection_index return selection_index
message = state_change.kwargs['reply_body'] message = state_change.kwargs['reply_body']
subject = state_change.kwargs['reply_subject'] subject = state_change.kwargs['reply_subject']
recipient = state_change.kwargs['reply_to'] recipient = state_change.kwargs['reply_to']
object = state_change['object'] event = state_change['object']
state_change['object'].MailHost.send(message, mto=recipient, event.MailHost.send(
mfrom=object.portal_preferences.getPreferredEventSenderEmail(), message,
subject=subject) mto=recipient,
mfrom=event.portal_preferences.getPreferredEventSenderEmail(),
subject=subject)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>state_change, validation_state=[\'published\', \'published_alive\', \'released\', \'released_alive\', \'shared\', \'shared_alive\'], now=None</string> </value> <value> <string>state_change, validation_state=(\'published\', \'published_alive\', \'released\', \'released_alive\', \'shared\', \'shared_alive\'), now=None</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -2,4 +2,5 @@ erp5_base ...@@ -2,4 +2,5 @@ erp5_base
erp5_web erp5_web
erp5_ingestion erp5_ingestion
erp5_jquery_sheet_editor erp5_jquery_sheet_editor
erp5_svg_editor erp5_svg_editor
\ No newline at end of file erp5_crm
\ No newline at end of file
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
<portal_type id="Production Packing List"> <portal_type id="Production Packing List">
<item>DeliveryCausalityStateConstraint</item> <item>DeliveryCausalityStateConstraint</item>
</portal_type> </portal_type>
</property_sheet_list> </property_sheet_list>
\ No newline at end of file
...@@ -5,12 +5,12 @@ if resource is not None: ...@@ -5,12 +5,12 @@ if resource is not None:
omit_optional_variation=1) omit_optional_variation=1)
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range.append( map(lambda x: (x[1],x[0]), context.getVariationCategoryItemList(base_category_list = (base_category,) ) ) ) cell_range.append([(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list=(base_category,))])
else: else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) ) cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range ) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
request = context.REQUEST
domain_list = [] domain_list = []
supply_chain_module = context.getPortalObject().supply_chain_module
if depth == 0: if depth == 0:
category_list = [] category_list = []
for q in context.ProductionOrderModule_getSelectionProductionOrderList(): for q in context.ProductionOrderModule_getSelectionProductionOrderList():
......
# this API uses format=
# pylint: disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
# this API uses format=
# pylint: disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
Manufacturing Execution | DeliveryCausalityStateConstraint Manufacturing Execution | DeliveryCausalityStateConstraint
Manufacturing Order Line | ProductionOrderLine Manufacturing Order Line | ProductionOrderLine
Production Order Line | ProductionOrderLine Production Order Line | ProductionOrderLine
Production Packing List | DeliveryCausalityStateConstraint Production Packing List | DeliveryCausalityStateConstraint
\ No newline at end of file
# Remove empty items if default_sub_field_property_dict is None:
item_list = filter(lambda x: x not in [('',''), ['','']], default_sub_field_property_dict = {}
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
for item in item_list: for item in item_list:
# Remove empty items
if item in (('', ''), ['', '']):
continue
# Get value of the item # Get value of the item
item_value = item[int(not is_right_display)] item_value = item[int(not is_right_display)]
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
# from Products.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Utils import cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def cartesianProduct(list_of_list):
if len(list_of_list) == 0:
return [[]]
result = []
head = list_of_list[0]
tail = list_of_list[1:]
product = cartesianProduct(tail)
for v in head:
for p in product:
result += [[v] + p]
return result
line = [] line = []
column = [] column = []
tab = [] tab = []
transformation = context.getParentValue() transformation = context.getParentValue()
# security.declareProtected(Permissions.AccessContentsInformation, 'getQLineItemList')
# def getQLineItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# """
# line_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[0]
# #LOG('getQLineItemList', 0, "%s" % str(line_category))
# if line_category is None:
# result = [(None,'')]
# else:
# result = self.getVariationRangeCategoryItemList(base_category_list = [line_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# #LOG('getQLineItemList', 10, "%s" % str(result))
# return result
# security.declareProtected(Permissions.AccessContentsInformation, 'getQColumnItemList')
# def getQColumnItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# """
# column_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[1]
# #LOG('getQColumnItemList', 0, "%s" % str(column_category))
# if column_category is None:
# result = [(None,'')]
# else:
# result = self.getVariationRangeCategoryItemList(base_category_list = [column_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# #LOG('getQColumnItemList', 0, "%s" % str(result))
# return result
# security.declareProtected(Permissions.AccessContentsInformation, 'getQTabItemList')
# def getQTabItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# Returns a list of items which can be used as index for
# each tab of a matrix or to define a cell range.
# """
# tab_category_list = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[2:]
# tab_category_item_list_list = []
# for tab_category in tab_category_list:
# tab_category_item_list = self.getVariationRangeCategoryItemList(base_category_list = [tab_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# tab_category_item_list_list.append(tab_category_item_list)
# transformation = self.getParentValue()
# transformation_category_item_list = transformation.getVariationCategoryItemList(
# display_id=display_id,
# base=base,
# current_category=current_category)
# tab_category_item_list_list.append(transformation_category_item_list)
# if len(tab_category_item_list_list) > 0:
# product_list = cartesianProduct(tab_category_item_list_list)
# result = []
# for item_list in product_list:
# value_list = []
# label_list = []
# for item in item_list:
# value_list.append(item[0])
# label_list.append(item[1])
# result.append((value_list, label_list))
# else:
# result = [(None,'')]
# return result
# base_cell_id possible value: 'quantity', 'variation' # base_cell_id possible value: 'quantity', 'variation'
base_cell_id = 'quantity' base_cell_id = 'quantity'
...@@ -160,43 +13,20 @@ get_variation_base_category_method_dict = { ...@@ -160,43 +13,20 @@ get_variation_base_category_method_dict = {
'variation': 'getVVariationBaseCategoryList' 'variation': 'getVVariationBaseCategoryList'
} }
# from Products.ERP5Type.Utils import cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def cartesianProduct(list_of_list):
if len(list_of_list) == 0:
return [[]]
result = []
head = list_of_list[0]
tail = list_of_list[1:]
product = cartesianProduct(tail)
for v in head:
for p in product:
result += [[v] + p]
return result
line = []
column = []
tab = []
transformation = context.getParentValue()
# Those value are define on property sheet of portal type # Those value are define on property sheet of portal type
line_base_category = transformation.getVariationBaseCategoryLine() line_base_category = transformation.getVariationBaseCategoryLine()
column_base_category = transformation.getVariationBaseCategoryColumn() column_base_category = transformation.getVariationBaseCategoryColumn()
# Calculate line and column # Calculate line and column
for axe, axe_base_category in [(line, line_base_category),(column, column_base_category)]: for axe, axe_base_category in [(line, line_base_category), (column, column_base_category)]:
clist = [] clist = []
#if axe_base_category in context.getVVariationBaseCategoryList(): #if axe_base_category in context.getVVariationBaseCategoryList():
if axe_base_category in getattr(context, get_variation_base_category_method_dict[base_cell_id])(): if axe_base_category in getattr(context, get_variation_base_category_method_dict[base_cell_id])():
if matrixbox:
if matrixbox == 1:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
axe += map(lambda x: (x[1],x[0]), transformation.getVariationCategoryItemList(base_category_list = (axe_base_category,) ) ) axe.extend([(x[1], x[0]) for x in transformation.getVariationCategoryItemList(base_category_list = (axe_base_category,) )])
else: else:
axe += transformation.getVariationCategoryList(base_category_list = (axe_base_category,) ) axe.extend(transformation.getVariationCategoryList(base_category_list = (axe_base_category,) ))
# Calculate tab # Calculate tab
# We can only display 3 dimension, so, we use a cartesian product to decrease matrix dimension # We can only display 3 dimension, so, we use a cartesian product to decrease matrix dimension
...@@ -207,11 +37,11 @@ for c in base_category_list: ...@@ -207,11 +37,11 @@ for c in base_category_list:
if not c in (line_base_category, column_base_category): if not c in (line_base_category, column_base_category):
#if c in context.getVVariationBaseCategoryList(): #if c in context.getVVariationBaseCategoryList():
if c in getattr(context, get_variation_base_category_method_dict[base_cell_id])(): if c in getattr(context, get_variation_base_category_method_dict[base_cell_id])():
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
base_category += [ map(lambda x: (x[1],x[0]), transformation.getVariationCategoryItemList(base_category_list = (c,) )) ] base_category.extend([(x[1], x[0]) for x in transformation.getVariationCategoryItemList(base_category_list = (c,)) ])
else: else:
base_category += [ transformation.getVariationCategoryList(base_category_list = (c,) ) ] base_category.extend(transformation.getVariationCategoryList(base_category_list = (c,)))
if len(base_category) > 0: if len(base_category) > 0:
# Then make a cartesian product # Then make a cartesian product
...@@ -222,12 +52,12 @@ if len(base_category) > 0: ...@@ -222,12 +52,12 @@ if len(base_category) > 0:
for c in clist: for c in clist:
if matrixbox == 1: if matrixbox == 1:
# XXX matrixbox is right display # XXX matrixbox is right display
tab.append( ( repr(map(lambda x: x[0], c)) , repr(map(lambda x: x[1], c)) ) ) tab.append((repr([x[0] for x in c]), repr([x[1] for x in c])))
else: else:
tab.append( repr(c) ) tab.append( repr(c) )
# Try fill line first, then column, and after tab # Try fill line first, then column, and after tab
for i in range(2): for _ in range(2):
if line == []: if line == []:
tmp = line tmp = line
line = column line = column
......
...@@ -11,15 +11,6 @@ def getPreferredCategoryDisplayMethodId(): ...@@ -11,15 +11,6 @@ def getPreferredCategoryDisplayMethodId():
return method == 'getTranslatedCompactTitle' and 'getCompactTranslatedTitle' \ return method == 'getTranslatedCompactTitle' and 'getCompactTranslatedTitle' \
or method or method
# Zope: waiting for __builtin__.set
set = lambda seq: dict((k,None) for k in seq).iterkeys()
# Zope: waiting for __builtin__.sorted
def sorted(seq):
l = list(seq)
l.sort()
return l
class ResourceSelection: class ResourceSelection:
""" """
Helper class to handle a selection of resources. Helper class to handle a selection of resources.
...@@ -67,7 +58,7 @@ class ResourceSelection: ...@@ -67,7 +58,7 @@ class ResourceSelection:
return common_quantity_unit_item_list return common_quantity_unit_item_list
def getCommonTransformedResourceItemList(self): def getCommonTransformedResourceItemList(self):
return [(r.title, r.relative_url) for r in \ return [(r.title, r.relative_url) for r in \
context.Resource_zGetTransformedResourceList(resource_uid=self.getUidList())] context.Resource_zGetTransformedResourceList(resource_uid=self.getUidList())]
self = ResourceSelection() self = ResourceSelection()
......
from math import log
result = context.getPriceParameterDict(context=movement, **kw) result = context.getPriceParameterDict(context=movement, **kw)
# Calculate # Calculate
......
...@@ -11,11 +11,9 @@ sampling_amount inventory lines, sorted by date. ...@@ -11,11 +11,9 @@ sampling_amount inventory lines, sorted by date.
# XXX: Might be set in preferences # XXX: Might be set in preferences
sampling_amount = kwargs.get('sampling_amount',20) sampling_amount = kwargs.get('sampling_amount',20)
from Products.ERP5Type.Document import newTempDocument
from DateTime import DateTime from DateTime import DateTime
resource = context resource = context
request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
node = portal.restrictedTraverse(kwargs.get('node')) node = portal.restrictedTraverse(kwargs.get('node'))
...@@ -47,7 +45,6 @@ inventory_tuple_list = [] ...@@ -47,7 +45,6 @@ inventory_tuple_list = []
precise_time_format = '%Y/%m/%d %H:%M.%S' precise_time_format = '%Y/%m/%d %H:%M.%S'
base_time_format = precise_time_format base_time_format = precise_time_format
rough_time_form = '%Y/%m/%d'
# XXX: Below performance issues: # XXX: Below performance issues:
# * sampling made in dumb way - it shall use SQL # * sampling made in dumb way - it shall use SQL
# * inventory is invoked 3 times for each sample # * inventory is invoked 3 times for each sample
...@@ -72,15 +69,16 @@ for i in range(0,sampling_amount): ...@@ -72,15 +69,16 @@ for i in range(0,sampling_amount):
inventory_tuple_list.append(internal_tuple) inventory_tuple_list.append(internal_tuple)
return_list = [] return_list = []
for a in range(0,len(inventory_tuple_list)): for a in range(0, len(inventory_tuple_list)):
d = newTempDocument( portal, str(a) )
data = inventory_tuple_list[a] data = inventory_tuple_list[a]
d.edit( return_list.append(
title = 'title %s'%(a,), portal.newContent(
date = data[0], portal_type='Base',
current = data[1], temp_object=True,
available = data[2], id=str(a),
future = data[3], title='title %s'%(a,),
) date=data[0],
return_list.append(d) current=data[1],
available=data[2],
future=data[3],))
return return_list return return_list
...@@ -42,11 +42,11 @@ for base_category_list in base_category_list_list: ...@@ -42,11 +42,11 @@ for base_category_list in base_category_list_list:
if matrixbox: if matrixbox:
# XXX matrixbox is right_display (not as listfield) # XXX matrixbox is right_display (not as listfield)
# => invert display and value in item # => invert display and value in item
cell_range.append(map(lambda x: (x[1], x[0]), cell_range.append([(x[1], x[0]) for x in
context.getVariationRangeCategoryItemList( context.getVariationRangeCategoryItemList(
base_category_list=base_category_list, base_category_list=base_category_list,
display_base_category=display_base_category, display_base_category=display_base_category,
sort_id='id'))) sort_id='id')])
else: else:
cell_range.append( cell_range.append(
context.getVariationRangeCategoryList( context.getVariationRangeCategoryList(
......
from Products.ERP5Type.Document import newTempAmount tmp_context = context.newContent(
tmp_context = newTempAmount(context, "temp_context", id="temp_context",
quantity=1.0, portal_type="Amount",
variation_category_list=reference_variation_category_list, temp_object=True,
resource=context.getRelativeUrl()) quantity=1.0,
variation_category_list=reference_variation_category_list,
resource=context.getRelativeUrl())
price_currency = kw.get('price_currency', None) price_currency = kw.get('price_currency', None)
result = context.getAggregatedAmountList(tmp_context) result = context.getAggregatedAmountList(tmp_context)
final_result = []
for line in result: for line in result:
resource = line.getResourceValue() resource = line.getResourceValue()
sender_value = None
if resource is not None: if resource is not None:
sender = line.getResourceValue().getPurchaseSupplyLineSource() sender = line.getResourceValue().getPurchaseSupplyLineSource()
line.setCategoryMembership('source', sender) line.setCategoryMembership('source', sender)
......
from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5Form.Report import ReportSection from Products.ERP5Form.Report import ReportSection
REQUEST = context.REQUEST REQUEST = context.REQUEST
...@@ -9,20 +10,6 @@ elif reference_variation_category_list == []: ...@@ -9,20 +10,6 @@ elif reference_variation_category_list == []:
result = [] result = []
# from Products.ERP5Type.Utils import cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def cartesianProduct(list_of_list):
if len(list_of_list) == 0:
return [[]]
result = []
head = list_of_list[0]
tail = list_of_list[1:]
product = cartesianProduct(tail)
for v in head:
for p in product:
result += [[v] + p]
return result
# Separate reference_variation_category_list by base category # Separate reference_variation_category_list by base category
variation_category_dict = {} variation_category_dict = {}
for variation_category in reference_variation_category_list: for variation_category in reference_variation_category_list:
...@@ -33,9 +20,7 @@ for variation_category in reference_variation_category_list: ...@@ -33,9 +20,7 @@ for variation_category in reference_variation_category_list:
variation_category_dict[base_category] = [variation_category] variation_category_dict[base_category] = [variation_category]
variation_key_list = cartesianProduct( variation_category_dict.values() ) variation_key_list = cartesianProduct( variation_category_dict.values() )
portal = context.portal_url.getPortalObject()
for variation_key in variation_key_list: for variation_key in variation_key_list:
params = { params = {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>reference_variation_category_list=[]</string> </value> <value> <string>reference_variation_category_list=()</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
if selection_name is not None: if selection_name is not None:
reference_variation_category_list = context.portal_selections.getSelectionParamsFor(selection_name)['reference_variation_category_list'] reference_variation_category_list = context.portal_selections.getSelectionParamsFor(selection_name)['reference_variation_category_list']
from Products.ERP5Type.Document import newTempAmount tmp_context = context.newContent(
tmp_context = newTempAmount(context, "temp_context", id="temp_context",
quantity=1.0, portal_type="Amount",
variation_category_list=reference_variation_category_list, temp_object=True,
resource=context.getRelativeUrl()) quantity=1.0,
variation_category_list=reference_variation_category_list,
resource=context.getRelativeUrl())
aal = context.getAggregatedAmountList(tmp_context) aal = context.getAggregatedAmountList(tmp_context)
result = aal.getTotalDuration() result = aal.getTotalDuration()
return result return result
else:
return None
if selection_name is not None: if selection_name is not None:
reference_variation_category_list = context.portal_selections.getSelectionParamsFor(selection_name)['reference_variation_category_list'] reference_variation_category_list = context.portal_selections.getSelectionParamsFor(selection_name)['reference_variation_category_list']
from Products.ERP5Type.Document import newTempAmount tmp_context = context.newContent(
tmp_context = newTempAmount(context, "temp_context", id="temp_context",
quantity=1.0, portal_type="Amount",
variation_category_list=reference_variation_category_list, temp_object=True,
resource=context.getRelativeUrl()) quantity=1.0,
variation_category_list=reference_variation_category_list,
resource=context.getRelativeUrl())
price_currency = context.REQUEST.get('price_currency', None) price_currency = context.REQUEST.get('price_currency', None)
aal = context.getAggregatedAmountList(tmp_context) aal = context.getAggregatedAmountList(tmp_context)
for line in aal: for line in aal:
resource = line.getResourceValue() resource = line.getResourceValue()
sender_value = None
if resource is not None: if resource is not None:
sender = line.getResourceValue().getPurchaseSupplyLineSource() sender = line.getResourceValue().getPurchaseSupplyLineSource()
line.setCategoryMembership('source', sender) line.setCategoryMembership('source', sender)
...@@ -19,7 +21,3 @@ if selection_name is not None: ...@@ -19,7 +21,3 @@ if selection_name is not None:
result = aal.getTotalPrice() result = aal.getTotalPrice()
return result return result
else:
return None
...@@ -13,25 +13,23 @@ line_base_category = transformation.getVariationBaseCategoryLine() ...@@ -13,25 +13,23 @@ line_base_category = transformation.getVariationBaseCategoryLine()
column_base_category = transformation.getVariationBaseCategoryColumn() column_base_category = transformation.getVariationBaseCategoryColumn()
base_category_list = transformation.getVariationBaseCategoryList() base_category_list = transformation.getVariationBaseCategoryList()
tab_base_category_list = filter(lambda x: x not in [line_base_category, tab_base_category_list = [x for x in base_category_list if x not in (line_base_category, column_base_category)]
column_base_category], base_category_list)
for c in ([line_base_category, column_base_category] + tab_base_category_list): for c in ([line_base_category, column_base_category] + tab_base_category_list):
# try to display line first, then column, and finally others # try to display line first, then column, and finally others
if c in getattr(context, if c in getattr(context,
get_variation_base_category_method_dict[base_id])(): get_variation_base_category_method_dict[base_id])():
# base category was selected by user # base category was selected by user
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) # XXX matrixbox is right_display (not as listfield)
# => invert display and value in item # => invert display and value in item
cell_range.append(map(lambda x: (x[1],x[0]), cell_range.append(
transformation.getVariationCategoryItemList [(x[1], x[0]) for x in transformation.getVariationCategoryItemList(base_category_list=(c,))])
(base_category_list=(c,))))
else: else:
cell_range.append(transformation.getVariationCategoryList( cell_range.append(transformation.getVariationCategoryList(
base_category_list=(c,))) base_category_list=(c,)))
# Remove empty range # Remove empty range
cell_range = filter(lambda x: x != [], cell_range) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
request = context.REQUEST
consumption_list = context.getSpecialiseValueList() consumption_list = context.getSpecialiseValueList()
# convert string to float # convert string to float
reference_quantity = float( reference_quantity ) reference_quantity = float( reference_quantity )
......
request = context.REQUEST
cell_key_list = context.getCellKeyList( base_id = 'variation') cell_key_list = context.getCellKeyList( base_id = 'variation')
for cell_key in cell_key_list: for cell_key in cell_key_list:
......
# Remove empty items if default_sub_field_property_dict is None:
item_list = filter(lambda x: x not in [('',''), ['','']], default_sub_field_property_dict = {}
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
for item in item_list: for item in item_list:
# Remove empty items
if item in (('', ''), ['', '']):
continue
# Get value of the item # Get value of the item
item_value = item[int(not is_right_display)] item_value = item[int(not is_right_display)]
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryCell_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -454,7 +454,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -454,7 +454,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree Applied Rule which implicitely defines a simulation subtree
""" """
return filter(lambda x:self.isTradeStateCompleted(explanation, x), self.getTradeStateList()) return [x for x in self.getTradeStateList() if self.isTradeStateCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradeStateList') security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradeStateList')
def getPartiallyCompletedTradeStateList(self, explanation): def getPartiallyCompletedTradeStateList(self, explanation):
...@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree Applied Rule which implicitely defines a simulation subtree
""" """
return filter(lambda x:self.isTradeStatePartiallyCompleted(explanation, x), self.getTradeStateList()) return [x for x in self.getTradeStateList() if self.isTradeStatePartiallyCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getLatestCompletedTradeStateList') security.declareProtected(Permissions.AccessContentsInformation, 'getLatestCompletedTradeStateList')
def getLatestCompletedTradeStateList(self, explanation): def getLatestCompletedTradeStateList(self, explanation):
...@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree Applied Rule which implicitely defines a simulation subtree
""" """
return filter(lambda x:self.isTradePhaseCompleted(explanation, x), self.getTradePhaseList()) return [x for x in self.getTradePhaseList() if self.isTradePhaseCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradePhaseList') security.declareProtected(Permissions.AccessContentsInformation, 'getPartiallyCompletedTradePhaseList')
def getPartiallyCompletedTradePhaseList(self, explanation): def getPartiallyCompletedTradePhaseList(self, explanation):
...@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree Applied Rule which implicitely defines a simulation subtree
""" """
return filter(lambda x:self.isTradePhasePartiallyCompleted(explanation, x), self.getTradePhaseList()) return [x for x in self.getTradePhaseList() if self.isTradePhasePartiallyCompleted(explanation, x)]
security.declareProtected(Permissions.AccessContentsInformation, 'isTradePhaseCompleted') security.declareProtected(Permissions.AccessContentsInformation, 'isTradePhaseCompleted')
def isTradePhaseCompleted(self, explanation, trade_phase): def isTradePhaseCompleted(self, explanation, trade_phase):
...@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject):
kw = self._getPropertyAndCategoryDict(explanation, amount, trade_model_path, delay_mode=delay_mode) kw = self._getPropertyAndCategoryDict(explanation, amount, trade_model_path, delay_mode=delay_mode)
trade_phase = filter_trade_phase(trade_model_path.getTradePhaseList()) trade_phase = filter_trade_phase(trade_model_path.getTradePhaseList())
try: try:
kw['trade_phase'], = trade_phase kw['trade_phase'], = trade_phase # pylint: disable=unpacking-non-sequence
except ValueError: except ValueError:
pass pass
kw.update(update_property_dict) kw.update(update_property_dict)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>BusinessProcess</string> </value> <value> <string>BusinessProcess</string> </value>
...@@ -43,13 +49,7 @@ ...@@ -43,13 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:457, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:467, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:551, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:561, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:697, 8: Attempting to unpack a non-sequence defined at line 655 (unpacking-non-sequence)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -59,13 +59,28 @@ ...@@ -59,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -78,7 +93,7 @@ ...@@ -78,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -87,7 +102,7 @@ ...@@ -87,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
############################################################################## ##############################################################################
from Products.ERP5Type.mixin.constraint import ConstraintMixin from Products.ERP5Type.mixin.constraint import ConstraintMixin
from zLOG import LOG
class DuplicateInventoryConstraint(ConstraintMixin): class DuplicateInventoryConstraint(ConstraintMixin):
""" """
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>DuplicateInventoryConstraint</string> </value> <value> <string>DuplicateInventoryConstraint</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.DuplicateInventoryConstraint</string> </value> <value> <string>document.erp5.DuplicateInventoryConstraint</string> </value>
...@@ -24,6 +36,18 @@ ...@@ -24,6 +36,18 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>erp5</string> </value> <value> <string>erp5</string> </value>
...@@ -31,13 +55,28 @@ ...@@ -31,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -50,7 +89,7 @@ ...@@ -50,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -59,53 +98,30 @@ ...@@ -59,53 +98,30 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>ERP5TypeTestCase</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
<item> <value> <string>validated</string> </value>
<key> <string>comment</string> </key> </item>
<value> <string></string> </value> </dictionary>
</item> </list>
<item> </value>
<key> <string>time</string> </key> </item>
<value> </dictionary>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1377844470.45</float>
<string>GMT+9</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -178,9 +178,17 @@ class TradeModelPath(Path): ...@@ -178,9 +178,17 @@ class TradeModelPath(Path):
result[base_category] = category_url_list result[base_category] = category_url_list
return result return result
def _filterCategoryList(self, category_list, category, spec=(), def _filterCategoryList(
filter=None, portal_type=(), base=0, self,
keep_default=1, checked_permission=None): category_list,
category,
spec=(),
filter=None, # pylint: disable=redefined-builtin
portal_type=(),
base=0,
keep_default=1,
checked_permission=None,
):
""" """
XXX - implementation missing XXX - implementation missing
TBD - look at CategoryTool._buildFilter for inspiration TBD - look at CategoryTool._buildFilter for inspiration
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>TradeModelPath</string> </value> <value> <string>TradeModelPath</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:182, 26: Redefining built-in \'filter\' (redefined-builtin)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -19,18 +19,18 @@ for brain in getattr(context.portal_simulation, inventory_list_method_dict[simul ...@@ -19,18 +19,18 @@ for brain in getattr(context.portal_simulation, inventory_list_method_dict[simul
**kw): **kw):
if positive_stock and negative_stock and not zero_stock and brain.inventory == 0: if positive_stock and negative_stock and not zero_stock and brain.inventory == 0:
result_list.append(brain) result_list.append(brain)
if positive_stock and not negative_stock and zero_stock and brain.inventory <0: if positive_stock and not negative_stock and zero_stock and brain.inventory <0:
result_list.append(brain) result_list.append(brain)
if negative_stock and zero_stock and not positive_stock and brain.inventory >0: if negative_stock and zero_stock and not positive_stock and brain.inventory >0:
result_list.append(brain) result_list.append(brain)
if positive_stock and not negative_stock and not zero_stock and brain.inventory <=0: if positive_stock and not negative_stock and not zero_stock and brain.inventory <=0:
result_list.append(brain) result_list.append(brain)
if negative_stock and not positive_stock and not zero_stock and brain.inventory >=0: if negative_stock and not positive_stock and not zero_stock and brain.inventory >=0:
result_list.append(brain) result_list.append(brain)
if zero_stock and not positive_stock and not negative_stock and brain.inventory!=0: if zero_stock and not positive_stock and not negative_stock and brain.inventory!=0:
result_list.append(brain) result_list.append(brain)
if not positive_stock and not negative_stock and not zero_stock: if not positive_stock and not negative_stock and not zero_stock:
result_list.append(brain) result_list.append(brain)
return sorted(result_list, key=lambda brain: (brain.getResourceReference(), brain.getResourceTitle(), brain.variation_text)) return sorted(result_list, key=lambda brain: (brain.getResourceReference(), brain.getResourceTitle(), brain.variation_text))
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories portal_categories = context.portal_categories
portal_preferences = context.portal_preferences portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList') method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
...@@ -4,12 +4,12 @@ if resource is not None: ...@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1) base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range.append( map(lambda x: (x[1],x[0]), context.getVariationCategoryItemList(base_category_list = (base_category,) ) ) ) cell_range.append([(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list = (base_category,))])
else: else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) ) cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range ) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
...@@ -4,12 +4,12 @@ if resource is not None: ...@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1) base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range.append( map(lambda x: (x[1],x[0]), context.getVariationCategoryItemList(base_category_list = (base_category,) ) ) ) cell_range.append( [(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list = (base_category,))] )
else: else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) ) cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range ) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
# Remove empty items if default_sub_field_property_dict is None:
item_list = filter(lambda x: x not in [('',''), ['','']],\ default_sub_field_property_dict = {}
item_list)
sub_field_dict = {} sub_field_dict = {}
split_depth = 1 split_depth = 1
resource = context.getResourceValue() resource = context.getResourceValue()
...@@ -12,6 +11,9 @@ else : ...@@ -12,6 +11,9 @@ else :
del default_sub_field_property_dict['item_list'] del default_sub_field_property_dict['item_list']
for item in item_list: for item in item_list:
# Remove empty items
if item in (('',''), ['','']):
continue
# Get value of the item # Get value of the item
item_value = item[int(not is_right_display)] item_value = item[int(not is_right_display)]
# Hash key from item_value # Hash key from item_value
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.PythonScripts.standard import Object from Products.PythonScripts.standard import Object
line_list = [] line_list = []
request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
# XXX use a larger limit # XXX use a larger limit
......
...@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList() ...@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList()
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill from string import zfill
global portal_object, new_id, l
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
new_id = 0
l = [] l = []
# function to create a new fast input line # function to create a new fast input line
def createInputLine(d_message): def createInputLine(d_message, new_id):
global portal_object, new_id, l
new_id += 1
int_len = 3 int_len = 3
o = newTempBase( portal_object o = newTempBase( portal_object
...@@ -28,8 +24,8 @@ def createInputLine(d_message): ...@@ -28,8 +24,8 @@ def createInputLine(d_message):
l.append(o) l.append(o)
# generate all lines for the fast input form # generate all lines for the fast input form
for d_message in divergence_messages_list: for i, d_message in enumerate(divergence_messages_list):
createInputLine(d_message) createInputLine(d_message, i)
# return the list of fast input lines # return the list of fast input lines
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
read_document_lines to False. Otherwise, it displays on read_document_lines to False. Otherwise, it displays on
the fast input all documents lines already added the fast input all documents lines already added
""" """
from Products.ERP5Type.Document import newTempBase
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
trade_document = context trade_document = context
...@@ -123,35 +122,35 @@ empty_line_cpt = 1 # this counter is used so that we always add a fix ...@@ -123,35 +122,35 @@ empty_line_cpt = 1 # this counter is used so that we always add a fix
i = len_line_list + 1 i = len_line_list + 1
if read_document_lines is False: if read_document_lines is False:
while empty_line_cpt <= lines_num: while empty_line_cpt <= lines_num:
while i in used_id: while i in used_id:
# do not used an id from previously generated lines # do not used an id from previously generated lines
i+=1 i+=1
# Retrieve values set by the update script # Retrieve values set by the update script
resource_relative_url = getattr(request,"field_listbox_resource_relative_url_new_%s"%i,None) resource_relative_url = getattr(request,"field_listbox_resource_relative_url_new_%s"%i,None)
resource_title = getattr(request,"field_listbox_title_new_%s"%i,None) resource_title = getattr(request,"field_listbox_title_new_%s"%i,None)
reference = getattr(request,"field_listbox_reference_new_%s"%i,None) reference = getattr(request,"field_listbox_reference_new_%s"%i,None)
obj=trade_document.newContent(portal_type=line_portal_type, obj=trade_document.newContent(portal_type=line_portal_type,
id = i, id = i,
uid="new_%s" % i, uid="new_%s" % i,
temp_object=1, temp_object=1,
reference=None, # otherwise it is acquired on parent reference=None, # otherwise it is acquired on parent
is_indexable=0,) is_indexable=0,)
used_id_append(i) used_id_append(i)
# Set values inputted by user # Set values inputted by user
if resource_title not in ('',None): if resource_title not in ('',None):
empty_line_cpt -= 1 empty_line_cpt -= 1
obj.edit(resource_title=resource_title) obj.edit(resource_title=resource_title)
if reference not in ('',None): if reference not in ('',None):
empty_line_cpt -= 1 empty_line_cpt -= 1
obj.edit(reference=reference) obj.edit(reference=reference)
# if a resource is selected, use it # if a resource is selected, use it
if resource_relative_url not in ('',None): if resource_relative_url not in ('',None):
empty_line_cpt -= 1 empty_line_cpt -= 1
resource = portal.restrictedTraverse(resource_relative_url) resource = portal.restrictedTraverse(resource_relative_url)
obj.setResourceValue(resource) obj.setResourceValue(resource)
empty_line_cpt += 1 empty_line_cpt += 1
result_append(obj) result_append(obj)
return result return result
from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject() portal = context.getPortalObject()
if context.getPortalType() in portal.getPortalSaleTypeList(): if context.getPortalType() in portal.getPortalSaleTypeList():
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
which were already created so that they are not duplicated. which were already created so that they are not duplicated.
""" """
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log
portal = context.getPortalObject() portal = context.getPortalObject()
# Retrieve line and cell portal type # Retrieve line and cell portal type
...@@ -21,7 +20,6 @@ for line in listbox: ...@@ -21,7 +20,6 @@ for line in listbox:
# Only create line if user has selected a resource # Only create line if user has selected a resource
if 'listbox_key' in line and (line.get('resource_relative_url', None) not in ("", None) \ if 'listbox_key' in line and (line.get('resource_relative_url', None) not in ("", None) \
or line.get('source', None) not in ("", None)): or line.get('source', None) not in ("", None)):
line_id = line['listbox_key']
if line.get('resource_relative_url', None) not in ("", None): if line.get('resource_relative_url', None) not in ("", None):
product = portal.restrictedTraverse(line["resource_relative_url"]) product = portal.restrictedTraverse(line["resource_relative_url"])
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[], **kw</string> </value> <value> <string>listbox=(), **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -6,10 +6,10 @@ if resource is not None: ...@@ -6,10 +6,10 @@ if resource is not None:
for base_category in base_category_list: for base_category in base_category_list:
if matrixbox == 1: if matrixbox == 1:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item # XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range.append( map(lambda x: (x[1],x[0]), context.getVariationCategoryItemList(base_category_list = (base_category,) ) ) ) cell_range.append( [(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list = (base_category,))] )
else: else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) ) cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range ) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
from DateTime import DateTime from DateTime import DateTime
def sorted(seq):
seq = seq[:]
seq.sort()
return seq
portal = context.getPortalObject() portal = context.getPortalObject()
request = portal.REQUEST
if not at_date: if not at_date:
at_date=DateTime() at_date=DateTime()
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Utils import UpperCase
portal_categories = context.portal_categories portal_categories = context.portal_categories
portal_preferences = context.portal_preferences portal_preferences = context.portal_preferences
method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList') method_id = portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
......
...@@ -8,13 +8,13 @@ if resource is not None: ...@@ -8,13 +8,13 @@ if resource is not None:
if matrixbox == 1: if matrixbox == 1:
# XXX matrixbox is right_display (not as listfield) => # XXX matrixbox is right_display (not as listfield) =>
# invert display and value in item # invert display and value in item
cell_range.append(map(lambda x: (x[1],x[0]),\ cell_range.append([(x[1], x[0]) for x in
context.getVariationCategoryItemList( context.getVariationCategoryItemList(
base_category_list = (base_category,)))) base_category_list = (base_category,))])
else: else:
cell_range.append(context.getVariationCategoryList(\ cell_range.append(context.getVariationCategoryList(\
base_category_list=(base_category,))) base_category_list=(base_category,)))
cell_range = filter(lambda x: x != [], cell_range) cell_range = [x for x in cell_range if x != []]
return cell_range return cell_range
request = container.REQUEST request = container.REQUEST
RESPONSE = request.RESPONSE
stat_line = request.get('stat_line', None) stat_line = request.get('stat_line', None)
return stat_line return stat_line
...@@ -4,9 +4,8 @@ and milestones. ...@@ -4,9 +4,8 @@ and milestones.
""" """
translateString = context.Base_translateString translateString = context.Base_translateString
request = context.REQUEST if not reference:
current_type = context.getPortalType() reference='SO'
if not reference: reference='SO'
def generateReference(prefix, order, portal_type): def generateReference(prefix, order, portal_type):
for order_line in order.contentValues(portal_type=portal_type): for order_line in order.contentValues(portal_type=portal_type):
......
...@@ -7,7 +7,7 @@ def getSourceReference(line): ...@@ -7,7 +7,7 @@ def getSourceReference(line):
for predicate in predicate_list: for predicate in predicate_list:
source_reference = predicate.getSourceReference() source_reference = predicate.getSourceReference()
if source_reference: if source_reference:
return source_reference return source_reference
return '' return ''
def getDestinationReference(line): def getDestinationReference(line):
...@@ -19,7 +19,7 @@ def getDestinationReference(line): ...@@ -19,7 +19,7 @@ def getDestinationReference(line):
for predicate in predicate_list: for predicate in predicate_list:
destination_reference = predicate.getDestinationReference() destination_reference = predicate.getDestinationReference()
if destination_reference: if destination_reference:
return destination_reference return destination_reference
return '' return ''
#if context.getPortalType() in context.getPortalSaleTypeList(): #if context.getPortalType() in context.getPortalSaleTypeList():
......
# this API uses format= as argument
# pylint: disable=redefined-builtin
# We wants to get data in order to do a nice summary of items inside the order # We wants to get data in order to do a nice summary of items inside the order
# This report will mainly usefull when the same resource is ordered on many # This report will mainly usefull when the same resource is ordered on many
# different lines # different lines
...@@ -14,15 +17,12 @@ error_kw = {} ...@@ -14,15 +17,12 @@ error_kw = {}
default_quantity_unit = None default_quantity_unit = None
default_quantity_unit_title = '' default_quantity_unit_title = ''
resource_dict = {} resource_dict = {}
summary_quantity_dict = {}
object_list = [] object_list = []
untranslatable_column_list = [] # We should not translate some columns untranslatable_column_list = [] # We should not translate some columns
full_total_price = 0 full_total_price = 0
worker_column_list = [] worker_column_list = []
source_trade_dict = {} source_trade_dict = {}
context_relative_url = context.getRelativeUrl()
def sortMovement(a, b): def sortMovement(a, b):
return cmp(a.getRelativeUrl(), b.getRelativeUrl()) return cmp(a.getRelativeUrl(), b.getRelativeUrl())
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
...@@ -9,7 +9,7 @@ def getSourceReference(line): ...@@ -9,7 +9,7 @@ def getSourceReference(line):
for predicate in predicate_list: for predicate in predicate_list:
source_reference = predicate.getSourceReference() source_reference = predicate.getSourceReference()
if source_reference: if source_reference:
return source_reference return source_reference
return '' return ''
def getSubLineList(obj): def getSubLineList(obj):
......
# this API uses format=
# pylint:disable=redefined-builtin
if target_language: if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10) container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
...@@ -5,15 +5,6 @@ entered on the fast input ...@@ -5,15 +5,6 @@ entered on the fast input
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
base_category = portal.portal_categories.quantity_unit
list_method_id = portal.portal_preferences.\
getPreferredCategoryChildItemListMethodId(
'getCategoryChildCompactLogicalPathItemList')
method = getattr(base_category, list_method_id)
item_list = method(base=0, local_sort_id=('int_index', 'translated_title'),
checked_permission='View')
result_item_list = [('', '')] result_item_list = [('', '')]
resource_value = context.getResourceValue() resource_value = context.getResourceValue()
...@@ -55,9 +46,9 @@ if resource_value is None: ...@@ -55,9 +46,9 @@ if resource_value is None:
resource_value = resource_list[0] resource_value = resource_list[0]
if resource_value is not None: if resource_value is not None:
quantity_unit_list = [(x.getTranslatedLogicalPath(), x.getCategoryRelativeUrl(base=0)) quantity_unit_list = [(x.getTranslatedLogicalPath(), x.getCategoryRelativeUrl(base=0))
for x in resource_value.getQuantityUnitValueList()] for x in resource_value.getQuantityUnitValueList()]
# return the first quantity_unit item of resource # return the first quantity_unit item of resource
result_item_list.extend(quantity_unit_list) result_item_list.extend(quantity_unit_list)
return result_item_list return result_item_list
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -31,7 +31,7 @@ for listitem in listbox : ...@@ -31,7 +31,7 @@ for listitem in listbox :
with ImmediateReindexContextManager() as immediate_reindex_context_manager: with ImmediateReindexContextManager() as immediate_reindex_context_manager:
# we build 'container_count' containers # we build 'container_count' containers
for container_number in range(container_count): for _ in range(container_count):
new_container_id = 'c'+str(next_container_number) new_container_id = 'c'+str(next_container_number)
# we use container_type to know which are the resource (and variation) # we use container_type to know which are the resource (and variation)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=[],cancel_url=\'\',next_container_int_index=1,**kw</string> </value> <value> <string>form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=(),cancel_url=\'\',next_container_int_index=1,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value> <value> <string>listbox=(),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Message import Message state_change['object'].Base_checkConsistency()
from Products.DCWorkflow.DCWorkflow import ValidationFailed
inventory = state_change['object']
# use of the constraint
inventory.Base_checkConsistency()
...@@ -8,7 +8,6 @@ Container Line | view ...@@ -8,7 +8,6 @@ Container Line | view
Container Line | view_quantity Container Line | view_quantity
Container | fast_input Container | fast_input
Container | view Container | view
Delivery Cell | view
Delivery Node Module | view Delivery Node Module | view
Delivery Node | view Delivery Node | view
Delivery Root Simulation Rule | view Delivery Root Simulation Rule | view
......
...@@ -810,10 +810,6 @@ def test_suite(): ...@@ -810,10 +810,6 @@ def test_suite():
# One way to fix this would be to allow a custom "init script" to be called # One way to fix this would be to allow a custom "init script" to be called
# on a portal type. # on a portal type.
'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration', 'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration',
# there's no container accepting delivery cell, but delivery cell has
# an interaction workflow which assumes delivery cell is contained in
# a delivery.
'test_erp5_trade_Delivery_Cell_DeliveryCell_view',
)) ))
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXHTML)) suite.addTest(unittest.makeSuite(TestXHTML))
......
...@@ -130,6 +130,43 @@ ignored_skin_id_set = { ...@@ -130,6 +130,43 @@ ignored_skin_id_set = {
'connectorERP5', 'connectorERP5',
'connectorPlone.py', 'connectorPlone.py',
'resolveUid', 'resolveUid',
'IndividualVariation_init',
'QuantityUnitConversion_getQuantityUnitList',
'ResourceModule_getConvertedInventoryList',
'ResourceModule_getConvertedInventoryStat',
'ResourceModule_getSelection',
'DeliveryModule_getDeliveryLineList',
'DeliveryModule_getDeliveryLineReportSectionList',
'DeliveryModule_getMovementPortalTypeItemList',
'DeliveryModule_getShipmentDeliveryList',
'DeliveryModule_getShipmentLineData',
'DeliveryModule_getShipmentLineList',
'DeliveryModule_getShipmentReportSectionList',
'OrderModule_activateGetOrderStatList',
'OrderModule_deleteAutoPlannedOrderList',
'OrderModule_filterOrderStatResul',
'OrderModule_getOrderReport',
'OrderModule_getOrderReportParameterDict',
'OrderModule_getOrderReportSectionList',
'OrderModule_getOrderStatList',
'OrderModule_launchOrderReport',
'OrderModule_processOrderStat',
'OrderModule_statOrderStatList',
'PackingListContent_updateAfterEdit',
'PackingListModule_getPackingListReport',
'Builder_selectAutoPlannedOrderList',
'Builder_updateManufacturingOrderAfterBuild',
'ManufacturingOrderBuilder_selectSimulationMovement',
'ProductionDelivery_copyOrderProperties',
'ProductionDelivery_generateReference',
'ProductionDelivery_getFutureInventoryList',
'ProductionDelivery_getSimulationStateColorText',
'CurrencyExchange_getExchangeRateList',
'ERP5Folder_getUnrestrictedContentTypeList',
'FCKeditor_getDocumentList',
'FCKeditor_getDocumentListQuery',
'FCKeditor_getImageList',
'FCKeditor_getSetReferenceUrl',
} }
# 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