Commit ebcd7ade authored by Rafael Monnerat's avatar Rafael Monnerat

Update from upstream/master

parents 3347e3f9 c7cb731e
Pipeline #35859 failed with stage
in 0 seconds
import zlib
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject() portal = context.getPortalObject()
active_process = portal.restrictedTraverse(active_process) active_process = portal.restrictedTraverse(active_process)
...@@ -12,7 +13,7 @@ if result_list: ...@@ -12,7 +13,7 @@ if result_list:
journal_lib=journal_lib, journal_lib=journal_lib,
result_list=result_list) result_list=result_list)
active_process.postResult(ActiveResult(detail=journal_fragment.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(journal_fragment.encode('utf8'))))
# delete no longer needed active process # delete no longer needed active process
this_journal_active_process.getParentValue().manage_delObjects(ids=[this_journal_active_process.getId()]) this_journal_active_process.getParentValue().manage_delObjects(ids=[this_journal_active_process.getId()])
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<comptabilite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="formatA47A-I-VII-1.xsd" xmlns:tal="http://xml.zope.org/namespaces/tal"> <comptabilite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="formatA47A-I-VII-1.xsd" xmlns:tal="http://xml.zope.org/namespaces/tal">
<exercice> <exercice>
<DateCloture tal:content="python: options['at_date'].strftime('%Y-%m-%d')">20141231</DateCloture> <DateCloture tal:content="python: options['at_date'].strftime('%Y-%m-%d')">20141231</DateCloture>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result.detail.decode('zlib')"/></tal:block> <tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: modules['zlib'].decompress(result.detail)"/></tal:block>
</exercice> </exercice>
</comptabilite> </comptabilite>
\ No newline at end of file
<journal xmlns:tal="http://xml.zope.org/namespaces/tal"> <journal xmlns:tal="http://xml.zope.org/namespaces/tal">
<JournalCode tal:content="options/journal_code"></JournalCode> <JournalCode tal:content="options/journal_code"></JournalCode>
<JournalLib tal:content="options/journal_lib"></JournalLib> <JournalLib tal:content="options/journal_lib"></JournalLib>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result.detail.decode('zlib')"/></tal:block> <tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: modules['zlib'].decompress(result.detail)"/></tal:block>
</journal> </journal>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
active result. active result.
We need a proxy role to post the result. We need a proxy role to post the result.
""" """
import zlib
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -12,10 +13,10 @@ if context.getSourceSectionUid() in section_uid_list: ...@@ -12,10 +13,10 @@ if context.getSourceSectionUid() in section_uid_list:
if any([line.getSource(portal_type='Account') for line in accounting_line_list]): if any([line.getSource(portal_type='Account') for line in accounting_line_list]):
source_xml = context.AccountingTransaction_viewAsSourceFECXML( source_xml = context.AccountingTransaction_viewAsSourceFECXML(
test_compta_demat_compatibility=test_compta_demat_compatibility) test_compta_demat_compatibility=test_compta_demat_compatibility)
active_process.postResult(ActiveResult(detail=source_xml.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(source_xml.encode('utf8'))))
if context.getDestinationSectionUid() in section_uid_list: if context.getDestinationSectionUid() in section_uid_list:
if any([line.getDestination(portal_type='Account') for line in accounting_line_list]): if any([line.getDestination(portal_type='Account') for line in accounting_line_list]):
destination_xml = context.AccountingTransaction_viewAsDestinationFECXML( destination_xml = context.AccountingTransaction_viewAsDestinationFECXML(
test_compta_demat_compatibility=test_compta_demat_compatibility) test_compta_demat_compatibility=test_compta_demat_compatibility)
active_process.postResult(ActiveResult(detail=destination_xml.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(destination_xml.encode('utf8'))))
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
############################################################################## ##############################################################################
import os import os
from string import zfill
from urllib import urlencode from urllib import urlencode
import tempfile import tempfile
from DateTime import DateTime from DateTime import DateTime
...@@ -82,14 +81,14 @@ def printBarcodeSheet(self, sheet_number=1, input_list=[], test=False): ...@@ -82,14 +81,14 @@ def printBarcodeSheet(self, sheet_number=1, input_list=[], test=False):
tempfile.tempdir = tempdir tempfile.tempdir = tempdir
if test: if test:
#Fake list #Fake list
input_list = os.linesep.join(['TEST%s' % zfill(b, 8) for b in range(1111111, 1111111 + ( row_number * column_number * sheet_number ))]) input_list = os.linesep.join(['TEST%s' % str(b).zfill(8) for b in range(1111111, 1111111 + ( row_number * column_number * sheet_number ))])
elif input_list not in ('', None): elif input_list not in ('', None):
if not isinstance(input_list, list): if not isinstance(input_list, list):
input_list = os.linesep.join(map(escapeString, input_list.split(os.linesep))) input_list = os.linesep.join(map(escapeString, input_list.split(os.linesep)))
else: else:
input_list = os.linesep.join(input_list) input_list = os.linesep.join(input_list)
else: else:
input_list = os.linesep.join(['%s' % zfill(self.portal_ids.generateNewId(id_group='barcode'), 12) for b in range( row_number * column_number * sheet_number )]) input_list = os.linesep.join(['%s' % str(self.portal_ids.generateNewId(id_group='barcode')).zfill(12) for b in range( row_number * column_number * sheet_number )])
text_command = 'echo "%s" > %s' % (input_list, new_txt_file_path) text_command = 'echo "%s" > %s' % (input_list, new_txt_file_path)
ret = os.system(text_command) ret = os.system(text_command)
if ret != 0: if ret != 0:
......
from string import zfill return str(context.portal_ids.getLastGeneratedId(id_group='barcode')).zfill(12)
return zfill(context.portal_ids.getLastGeneratedId(id_group='barcode'),12)
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
import os import os
import subprocess import subprocess
from cStringIO import StringIO from io import BytesIO
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
...@@ -117,7 +116,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -117,7 +116,7 @@ class Image(TextConvertableMixin, File, OFSImage):
content_type, width, height = getImageInfo(self.data) content_type, width, height = getImageInfo(self.data)
if not content_type: if not content_type:
try: try:
image = PIL.Image.open(StringIO(str(self.data))) image = PIL.Image.open(BytesIO(bytes(self.data)))
except IOError: except IOError:
width = height = -1 width = height = -1
content_type = 'application/unknown' content_type = 'application/unknown'
...@@ -381,7 +380,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -381,7 +380,7 @@ class Image(TextConvertableMixin, File, OFSImage):
else: else:
parameter_list.append('-') parameter_list.append('-')
data = str(self.getData()) data = bytes(self.getData())
if self.getContentType() == "image/svg+xml": if self.getContentType() == "image/svg+xml":
data = transformUrlToDataURI(data) data = transformUrlToDataURI(data)
...@@ -401,7 +400,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -401,7 +400,7 @@ class Image(TextConvertableMixin, File, OFSImage):
finally: finally:
del process del process
if image: if image:
return StringIO(image) return BytesIO(image)
raise ConversionError('Image conversion failed (%s).' % err) raise ConversionError('Image conversion failed (%s).' % err)
def _getContentTypeAndImageData( def _getContentTypeAndImageData(
......
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
# #
############################################################################## ##############################################################################
import re, zipfile, cStringIO import re, zipfile
from io import BytesIO
from warnings import warn from warnings import warn
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from OFS.Image import Pdata from OFS.Image import Pdata
...@@ -38,7 +39,7 @@ from Products.ERP5Type.Cache import CachingMethod ...@@ -38,7 +39,7 @@ from Products.ERP5Type.Cache import CachingMethod
from erp5.component.document.File import File from erp5.component.document.File import File
from erp5.component.document.Document import Document, \ from erp5.component.document.Document import Document, \
VALID_IMAGE_FORMAT_LIST, ConversionError, NotConvertedError VALID_IMAGE_FORMAT_LIST, ConversionError, NotConvertedError
from Products.ERP5Type.Utils import fill_args_from_request from Products.ERP5Type.Utils import bytes2str, fill_args_from_request, str2bytes
# Mixin Import # Mixin Import
from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin
...@@ -198,10 +199,10 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -198,10 +199,10 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
raise NotConvertedError() raise NotConvertedError()
if format == 'text-content': if format == 'text-content':
# Extract text from the ODF file # Extract text from the ODF file
cs = cStringIO.StringIO() cs = BytesIO()
cs.write(str(self.getBaseData())) cs.write(self.getBaseData())
z = zipfile.ZipFile(cs) z = zipfile.ZipFile(cs)
s = z.read('content.xml') s = bytes2str(z.read('content.xml'))
s = self.rx_strip.sub(" ", s) # strip xml s = self.rx_strip.sub(" ", s) # strip xml
s = self.rx_compr.sub(" ", s) # compress multiple spaces s = self.rx_compr.sub(" ", s) # compress multiple spaces
cs.close() cs.close()
...@@ -210,7 +211,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -210,7 +211,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self) server_proxy = DocumentConversionServerProxy(self)
orig_format = self.getBaseContentType() orig_format = self.getBaseContentType()
generate_result = server_proxy.run_generate(self.getId(), generate_result = server_proxy.run_generate(self.getId(),
enc(str(self.getBaseData())), bytes2str(enc(bytes(self.getBaseData()))),
None, None,
format, format,
orig_format) orig_format)
...@@ -222,7 +223,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -222,7 +223,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
response_dict = generate_result response_dict = generate_result
# XXX: handle possible OOOd server failure # XXX: handle possible OOOd server failure
return response_dict['mime'], Pdata(dec(response_dict['data'])) return response_dict['mime'], Pdata(dec(str2bytes(response_dict['data'])))
# Conversion API # Conversion API
def _convert(self, format, frame=0, **kw): # pylint: disable=redefined-builtin def _convert(self, format, frame=0, **kw): # pylint: disable=redefined-builtin
...@@ -258,7 +259,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -258,7 +259,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
original_format = format original_format = format
allowed_format_list = self.getTargetFormatList() allowed_format_list = self.getTargetFormatList()
if format == 'base-data': if format == 'base-data':
return self.getBaseContentType(), str(self.getBaseData()) return self.getBaseContentType(), self.getBaseData()
if format == 'pdf': if format == 'pdf':
format_list = [x for x in allowed_format_list format_list = [x for x in allowed_format_list
if x.endswith('pdf')] if x.endswith('pdf')]
...@@ -301,8 +302,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -301,8 +302,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
if is_html: if is_html:
# Extra processing required since # Extra processing required since
# we receive a zip file # we receive a zip file
cs = cStringIO.StringIO() cs = BytesIO()
cs.write(str(data)) cs.write(bytes(data)) # Cast explicitly to bytes for possible Pdata
z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient
for f in z.infolist(): for f in z.infolist():
fn = f.filename fn = f.filename
...@@ -324,7 +325,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -324,7 +325,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
# create temporary image and use it to resize accordingly # create temporary image and use it to resize accordingly
temp_image = self.portal_contributions.newContent( temp_image = self.portal_contributions.newContent(
portal_type='Image', portal_type='Image',
file=cStringIO.StringIO(), file=BytesIO(),
filename=self.getId(), filename=self.getId(),
temp_object=1) temp_object=1)
temp_image._setData(data) temp_image._setData(data)
...@@ -346,8 +347,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -346,8 +347,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
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')]
mime, data = self._getConversionFromProxyServer(format_list[0]) mime, data = self._getConversionFromProxyServer(format_list[0])
archive_file = cStringIO.StringIO() archive_file = BytesIO()
archive_file.write(str(data)) archive_file.write(data)
zip_file = zipfile.ZipFile(archive_file) zip_file = zipfile.ZipFile(archive_file)
must_close = 1 must_close = 1
else: else:
...@@ -384,13 +385,13 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -384,13 +385,13 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self) server_proxy = DocumentConversionServerProxy(self)
response_code, response_dict, response_message = server_proxy.run_convert( response_code, response_dict, response_message = server_proxy.run_convert(
self.getFilename() or self.getId(), self.getFilename() or self.getId(),
enc(str(self.getData())), bytes2str(enc(bytes(self.getData()))),
None, None,
None, None,
self.getContentType()) self.getContentType())
if response_code == 200: if response_code == 200:
# sucessfully converted document # sucessfully converted document
self._setBaseData(dec(response_dict['data'])) self._setBaseData(dec(str2bytes(response_dict['data'])))
metadata = response_dict['meta'] metadata = response_dict['meta']
self._base_metadata = metadata self._base_metadata = metadata
if metadata.get('MIMEType', None) is not None: if metadata.get('MIMEType', None) is not None:
...@@ -423,11 +424,11 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -423,11 +424,11 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self) server_proxy = DocumentConversionServerProxy(self)
response_code, response_dict, response_message = \ response_code, response_dict, response_message = \
server_proxy.run_setmetadata(self.getId(), server_proxy.run_setmetadata(self.getId(),
enc(str(self.getBaseData())), bytes2str(enc(bytes(self.getBaseData()))),
kw) kw)
if response_code == 200: if response_code == 200:
# successful meta data extraction # successful meta data extraction
self._setBaseData(dec(response_dict['data'])) self._setBaseData(dec(str2bytes(response_dict['data'])))
self.updateFileMetadata() # record in workflow history # XXX must put appropriate comments. self.updateFileMetadata() # record in workflow history # XXX must put appropriate comments.
else: else:
# Explicitly raise the exception! # Explicitly raise the exception!
......
import io
import six
from Products.ERP5Type.Utils import str2bytes
# pylint:disable=import-error
def generateBarcodeImage(self, barcode_type, data, REQUEST=None): def generateBarcodeImage(self, barcode_type, data, REQUEST=None):
# huBarcode's DataMatrix support has limitation for data size. # type: (str, str, HTTPRequest) -> bytes
# huBarcode's QRCode support is broken.
# more 1-D barcode types can be added by pyBarcode library.
barcode_type = barcode_type.lower() barcode_type = barcode_type.lower()
if barcode_type == 'datamatrix': if barcode_type == 'datamatrix':
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
...@@ -10,26 +13,51 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None): ...@@ -10,26 +13,51 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None):
stdout=PIPE, stdout=PIPE,
stderr=PIPE, stderr=PIPE,
close_fds=True) close_fds=True)
output, _ = process.communicate(input=data) output, _ = process.communicate(input=str2bytes(data))
elif barcode_type == 'ean13': elif barcode_type == 'ean13':
if six.PY3:
import barcode.ean
import barcode.writer
fp = io.BytesIO()
barcode.ean.EuropeanArticleNumber13(
data, writer=barcode.writer.ImageWriter()
).render().save(fp, format='png')
output = fp.getvalue()
else:
from hubarcode.ean13 import EAN13Encoder from hubarcode.ean13 import EAN13Encoder
encoder = EAN13Encoder(data) encoder = EAN13Encoder(data)
output = encoder.get_imagedata() output = encoder.get_imagedata()
elif barcode_type == 'code128': elif barcode_type == 'code128':
if six.PY3:
import barcode.codex
import barcode.writer
class NoTextImageWriter(barcode.writer.ImageWriter):
def _paint_text(self, *args):
pass
fp = io.BytesIO()
barcode.codex.Code128(
data, writer=NoTextImageWriter()
).render(
# we also set a font_size of 0, so that the bounding box of the
# image does not include white space for the text.
writer_options={'font_size': 0}
).save(fp, format='png')
output = fp.getvalue()
else:
from hubarcode.code128 import Code128Encoder from hubarcode.code128 import Code128Encoder
encoder = Code128Encoder(data) encoder = Code128Encoder(data)
encoder.text = '' # get barcode image only encoder.text = '' # get barcode image only
output = encoder.get_imagedata() output = encoder.get_imagedata()
elif barcode_type == 'qrcode': elif barcode_type == 'qrcode':
import qrcode import qrcode
from cStringIO import StringIO fp = io.BytesIO()
fp = StringIO() img = qrcode.make(str2bytes(data))
img = qrcode.make(data)
img.save(fp, 'png') img.save(fp, 'png')
fp.seek(0) fp.seek(0)
output = fp.read() output = fp.getvalue()
else: else:
raise NotImplementedError('barcode_type=%s is not supported' % barcode_type) raise NotImplementedError('barcode_type=%s is not supported' % barcode_type)
if REQUEST is not None: if REQUEST is not None:
REQUEST.RESPONSE.setHeader('Content-Type', 'image/png') REQUEST.RESPONSE.setHeader('Content-Type', 'image/png')
return output return output
# pylint:enable=import-error
...@@ -38,6 +38,7 @@ from erp5.component.interface.IEncryptedPassword import IEncryptedPassword ...@@ -38,6 +38,7 @@ from erp5.component.interface.IEncryptedPassword import IEncryptedPassword
from Products.ERP5Type.Globals import PersistentMapping from Products.ERP5Type.Globals import PersistentMapping
from Products.CMFCore.utils import _checkPermission from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.exceptions import AccessControl_Unauthorized from Products.CMFCore.exceptions import AccessControl_Unauthorized
from six import string_types as basestring
@zope.interface.implementer(IEncryptedPassword,) @zope.interface.implementer(IEncryptedPassword,)
class EncryptedPasswordMixin(object): class EncryptedPasswordMixin(object):
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
import urllib2 import urllib2
from lxml import etree from lxml import etree
from erp5.component.document.Document import ConversionError from erp5.component.document.Document import ConversionError
import base64
from Products.ERP5Type.Utils import bytes2str
SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg" SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg"
...@@ -38,7 +40,7 @@ def getDataURI(url): ...@@ -38,7 +40,7 @@ def getDataURI(url):
except Exception as e: except Exception as e:
raise ConversionError("Error to transform url (%s) into data uri. ERROR = %s" % (url, Exception(e))) raise ConversionError("Error to transform url (%s) into data uri. ERROR = %s" % (url, Exception(e)))
return 'data:%s;base64,%s' % (data.info()["content-type"], return 'data:%s;base64,%s' % (data.info()["content-type"],
data.read().encode("base64").replace('\n', "")) bytes2str(base64.b64encode(data.read())).replace('\n', ""))
def transformUrlToDataURI(content): def transformUrlToDataURI(content):
if content is None or len(content) == 0: if content is None or len(content) == 0:
......
...@@ -35,8 +35,8 @@ for item in item_list: ...@@ -35,8 +35,8 @@ for item in item_list:
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
item_split = string.split(item_value, '/') item_split = item_value.split('/')
item_key = string.join(item_split[:split_depth] , '/' ) item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0] base_category = item_split[0]
multi = True multi = True
......
...@@ -30,8 +30,8 @@ for item in item_list: ...@@ -30,8 +30,8 @@ for item in item_list:
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
item_split = string.split(item_value, '/') item_split = item_value.split('/')
item_key = string.join(item_split[:split_depth] , '/' ) item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0] base_category = item_split[0]
multi = False # XXX or now budget level are only single value. multi = False # XXX or now budget level are only single value.
......
...@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject ...@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin
from erp5.component.interface.IConfiguratorItem import IConfiguratorItem from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
from six import string_types as basestring
@zope.interface.implementer(IConfiguratorItem) @zope.interface.implementer(IConfiguratorItem)
class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject): class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
......
from string import zfill
################################################## ##################################################
#### About the transformation_rules structure #### #### About the transformation_rules structure ####
# a key indicate that input of that level having the same value must be grouped together # a key indicate that input of that level having the same value must be grouped together
......
from string import zfill
################################################## ##################################################
#### About the transformation_rules structure #### #### About the transformation_rules structure ####
# a key indicate that input of that level having the same value must be grouped together # a key indicate that input of that level having the same value must be grouped together
...@@ -92,7 +90,7 @@ for upper_level_key in structured_input_data: ...@@ -92,7 +90,7 @@ for upper_level_key in structured_input_data:
for second_level in structured_input_data[upper_level_key][1]: for second_level in structured_input_data[upper_level_key][1]:
second_level_id += 10 second_level_id += 10
new_2nd_level_obj = new_1st_level_obj.newContent( portal_type = level_portal_types[1] new_2nd_level_obj = new_1st_level_obj.newContent( portal_type = level_portal_types[1]
, id = zfill(second_level_id, 4) , id = str(second_level_id).zfill(4)
) )
for property_title in second_level.keys(): for property_title in second_level.keys():
new_2nd_level_obj.setProperty(property_title, second_level[property_title]) new_2nd_level_obj.setProperty(property_title, second_level[property_title])
......
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill
global portal_object, new_id, l global portal_object, new_id, l
...@@ -14,7 +13,7 @@ def createInputLine(): ...@@ -14,7 +13,7 @@ def createInputLine():
int_len = 3 int_len = 3
o = newTempBase( portal_object o = newTempBase( portal_object
, str(new_id) , str(new_id)
, uid ='new_%s' % zfill(new_id, int_len) , uid ='new_%s' % str(new_id).zfill(int_len)
) )
l.append(o) l.append(o)
......
from string import zfill
destination_obj = context.getObject() destination_obj = context.getObject()
first_level_type = 'Use Case Scenario' first_level_type = 'Use Case Scenario'
......
...@@ -2178,3 +2178,26 @@ class TestImage(ERP5TypeTestCase): ...@@ -2178,3 +2178,26 @@ class TestImage(ERP5TypeTestCase):
content_type, content_type,
(filename, image.getContentType(), content_type)) (filename, image.getContentType(), content_type))
self.portal.manage_delObjects([self.id()]) self.portal.manage_delObjects([self.id()])
class Base_generateBarcodeImageTest(ERP5TypeTestCase):
def test_datamatrix_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='datamatrix', data='test')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_ean13_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='ean13', data='0799439112766')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_code128_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='code128', data='123')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_qrcode_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='qrcode', data='test')
self.assertTrue(png.startswith(b'\x89PNG'), png)
...@@ -351,7 +351,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -351,7 +351,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# XXX: duplicate ActivityTool.tic, without locking as we are being # XXX: duplicate ActivityTool.tic, without locking as we are being
# multiple activity nodes in a single process. # multiple activity nodes in a single process.
for activity in ActivityTool.activity_dict.itervalues(): for activity in ActivityTool.activity_dict.itervalues():
while not activity.dequeueMessage(activity_tool, node_id, ()): while activity.dequeueMessage(activity_tool, node_id, ()):
pass pass
# Monkey-patch catalog to synchronise between main thread and the # Monkey-patch catalog to synchronise between main thread and the
# isolated transaction. # isolated transaction.
......
...@@ -2,3 +2,4 @@ erp5_full_text_mroonga_catalog ...@@ -2,3 +2,4 @@ erp5_full_text_mroonga_catalog
erp5_base erp5_base
erp5_csv_style erp5_csv_style
erp5_core_proxy_field_legacy erp5_core_proxy_field_legacy
erp5_simulation_test
\ No newline at end of file
...@@ -19,6 +19,7 @@ test.erp5.testERP5Catalog ...@@ -19,6 +19,7 @@ test.erp5.testERP5Catalog
test.erp5.testERP5Category test.erp5.testERP5Category
test.erp5.testERP5Coordinate test.erp5.testERP5Coordinate
test.erp5.testERP5Core test.erp5.testERP5Core
test.erp5.testERP5CoreSkins
test.erp5.testERP5Form test.erp5.testERP5Form
test.erp5.testERP5Type test.erp5.testERP5Type
test.erp5.testERP5TypeInterfaces test.erp5.testERP5TypeInterfaces
......
...@@ -29,7 +29,11 @@ if context.getPortalType() in ["Presentation"]: ...@@ -29,7 +29,11 @@ if context.getPortalType() in ["Presentation"]:
portal = context.getPortalObject() portal = context.getPortalObject()
mimetype = 'text/html' mimetype = 'text/html'
content_type = context.getContentType() content_type = context.getContentType()
raw_data = portal.portal_transforms.convertToData(mimetype, str(context.getData() or ""), context=context, mimetype=content_type) raw_data = portal.portal_transforms.convertToData(
mimetype,
bytes(context.getData() or b""),
context=context,
mimetype=content_type)
if raw_data is None: if raw_data is None:
raise ValueError("Failed to convert to %r" % mimetype) raise ValueError("Failed to convert to %r" % mimetype)
if context.REQUEST is not None: if context.REQUEST is not None:
......
<?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>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>version_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>33.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Versions</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}/Document_viewVersionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -32,13 +32,16 @@ import zope.interface ...@@ -32,13 +32,16 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Utils import bytes2str
from erp5.component.interface.IWatermarkable import IWatermarkable from erp5.component.interface.IWatermarkable import IWatermarkable
from erp5.component.document.Image import Image from erp5.component.document.Image import Image
from erp5.component.document.Document import ConversionError from erp5.component.document.Document import ConversionError
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from zLOG import LOG, INFO, PROBLEM from zLOG import LOG, INFO, PROBLEM
import errno import errno
from StringIO import StringIO from io import BytesIO
from six.moves import range
import six
@zope.interface.implementer(IWatermarkable) @zope.interface.implementer(IWatermarkable)
class PDFDocument(Image): class PDFDocument(Image):
...@@ -90,8 +93,8 @@ class PDFDocument(Image): ...@@ -90,8 +93,8 @@ class PDFDocument(Image):
raise ValueError("watermark_data cannot not be empty") raise ValueError("watermark_data cannot not be empty")
if not self.hasData(): if not self.hasData():
raise ValueError("Cannot watermark an empty document") raise ValueError("Cannot watermark an empty document")
self_reader = PdfFileReader(StringIO(self.getData())) self_reader = PdfFileReader(BytesIO(self.getData()))
watermark_reader = PdfFileReader(StringIO(watermark_data)) watermark_reader = PdfFileReader(BytesIO(watermark_data))
watermark_page_count = watermark_reader.getNumPages() watermark_page_count = watermark_reader.getNumPages()
output = PdfFileWriter() output = PdfFileWriter()
...@@ -109,7 +112,7 @@ class PDFDocument(Image): ...@@ -109,7 +112,7 @@ class PDFDocument(Image):
self_page.mergePage(watermark_page) self_page.mergePage(watermark_page)
output.addPage(self_page) output.addPage(self_page)
outputStream = StringIO() outputStream = BytesIO()
output.write(outputStream) output.write(outputStream)
return outputStream.getvalue() return outputStream.getvalue()
...@@ -171,7 +174,7 @@ class PDFDocument(Image): ...@@ -171,7 +174,7 @@ class PDFDocument(Image):
""" """
if not self.hasData(): if not self.hasData():
return '' return ''
data = str(self.getData()) data = bytes(self.getData())
try: try:
from PyPDF2 import PdfFileReader from PyPDF2 import PdfFileReader
from PyPDF2.utils import PdfReadError from PyPDF2.utils import PdfReadError
...@@ -179,7 +182,7 @@ class PDFDocument(Image): ...@@ -179,7 +182,7 @@ class PDFDocument(Image):
pass pass
else: else:
try: try:
if PdfFileReader(StringIO(data)).isEncrypted: if PdfFileReader(BytesIO(data)).isEncrypted:
return '' return ''
except PdfReadError: except PdfReadError:
return '' return ''
...@@ -344,7 +347,7 @@ class PDFDocument(Image): ...@@ -344,7 +347,7 @@ class PDFDocument(Image):
raise raise
result = {} result = {}
for line in command_result.splitlines(): for line in bytes2str(command_result).splitlines():
item_list = line.split(':') item_list = line.split(':')
key = item_list[0].strip() key = item_list[0].strip()
value = ':'.join(item_list[1:]).strip() value = ':'.join(item_list[1:]).strip()
...@@ -360,9 +363,9 @@ class PDFDocument(Image): ...@@ -360,9 +363,9 @@ class PDFDocument(Image):
else: else:
try: try:
pdf_file = PdfFileReader(tmp) pdf_file = PdfFileReader(tmp)
for info_key, info_value in (pdf_file.getDocumentInfo() or {}).iteritems(): for info_key, info_value in six.iteritems(pdf_file.getDocumentInfo() or {}):
info_key = info_key.lstrip("/") info_key = info_key.lstrip("/")
if isinstance(info_value, unicode): if six.PY2 and isinstance(info_value, six.text_type):
info_value = info_value.encode("utf-8") info_value = info_value.encode("utf-8")
# Ignore values that cannot be pickled ( such as AAPL:Keywords ) # Ignore values that cannot be pickled ( such as AAPL:Keywords )
......
...@@ -49,6 +49,7 @@ Image | jump_to_wiki_predecessor ...@@ -49,6 +49,7 @@ Image | jump_to_wiki_predecessor
Image | local_permission Image | local_permission
Image | related_document Image | related_document
Image | version_view Image | version_view
Notification Message | version_view
PDF | download PDF | download
PDF | file_upload PDF | file_upload
PDF | jump_to_all_related PDF | jump_to_all_related
......
...@@ -41,6 +41,7 @@ from erp5.component.module.WorkingCopy import \ ...@@ -41,6 +41,7 @@ from erp5.component.module.WorkingCopy import \
WorkingCopy, Dir, File, selfcached, \ WorkingCopy, Dir, File, selfcached, \
NotAWorkingCopyError, NotVersionedError, VcsConflictError NotAWorkingCopyError, NotVersionedError, VcsConflictError
from erp5.component.module.SubversionClient import newSubversionClient from erp5.component.module.SubversionClient import newSubversionClient
from six import string_types as basestring
# XXX This does not work with concurrent processes/threads accessing the # XXX This does not work with concurrent processes/threads accessing the
# same working copy... # same working copy...
......
...@@ -41,6 +41,7 @@ from DateTime import DateTime ...@@ -41,6 +41,7 @@ from DateTime import DateTime
from ZTUtils import make_query from ZTUtils import make_query
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
from Products.ERP5Type.Utils import simple_decorator from Products.ERP5Type.Utils import simple_decorator
from six import string_types as basestring
@simple_decorator @simple_decorator
def selfcached(func): def selfcached(func):
......
import json import json
from six import string_types as basestring
commit_dict = json.loads(commit_json) if commit_json is not None else { commit_dict = json.loads(commit_json) if commit_json is not None else {
'added': (), 'added': (),
......
...@@ -8,6 +8,7 @@ else: ...@@ -8,6 +8,7 @@ else:
print('<div style="color: black">') print('<div style="color: black">')
# XXX: ERP5VCS_doCreateJavaScriptStatus should send lists # XXX: ERP5VCS_doCreateJavaScriptStatus should send lists
from six import string_types as basestring
if isinstance(added, basestring): if isinstance(added, basestring):
added = added != 'none' and filter(None, added.split(',')) or () added = added != 'none' and filter(None, added.split(',')) or ()
if isinstance(modified, basestring): if isinstance(modified, basestring):
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from DateTime import DateTime from DateTime import DateTime
from string import capitalize
from erp5.component.module.DateUtils import centis, getClosestDate, addToDate from erp5.component.module.DateUtils import centis, getClosestDate, addToDate
from erp5.component.module.DateUtils import getDecimalNumberOfYearsBetween from erp5.component.module.DateUtils import getDecimalNumberOfYearsBetween
...@@ -99,7 +98,7 @@ class AmortisationRule(RuleMixin): ...@@ -99,7 +98,7 @@ class AmortisationRule(RuleMixin):
modified_properties = [] modified_properties = []
for (key, value) in calculated_movement.items(): for (key, value) in calculated_movement.items():
if key not in ('name','status','id','divergent'): if key not in ('name','status','id','divergent'):
getter_name = 'get%s' % ''.join([capitalize(o) for o in key.split('_')]) getter_name = 'get%s' % ''.join([o.capitalize() for o in key.split('_')])
getter = getattr(simulation_movement, getter_name) getter = getattr(simulation_movement, getter_name)
previous_value = getter() previous_value = getter()
# Check if this property changes # Check if this property changes
...@@ -109,7 +108,7 @@ class AmortisationRule(RuleMixin): ...@@ -109,7 +108,7 @@ class AmortisationRule(RuleMixin):
if value is None and key.split('_')[-1] == 'value': if value is None and key.split('_')[-1] == 'value':
key = '_'.join(key.split('_')[:-1]) key = '_'.join(key.split('_')[:-1])
setter_name = 'set%s' % ''.join([capitalize(o) for o in key.split('_')]) setter_name = 'set%s' % ''.join([o.capitalize() for o in key.split('_')])
setter = getattr(simulation_movement, setter_name) setter = getattr(simulation_movement, setter_name)
setter(value) setter(value)
simulation_movement.edit(start_date=simulation_movement.getStopDate()) simulation_movement.edit(start_date=simulation_movement.getStopDate())
......
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
# This script adds the needed actions in the Immobilisation portal_type, and # This script adds the needed actions in the Immobilisation portal_type, and
# each amortisable portal_type # each amortisable portal_type
from string import capitalize
def addAction(portal_type, portal_type_type, country, amortisation_method): def addAction(portal_type, portal_type_type, country, amortisation_method):
print('Adding UI tab "Amortisation Details" for method %s on portal_type %s... ' % (amortisation_method,portal_type), end=' ') print('Adding UI tab "Amortisation Details" for method %s on portal_type %s... ' % (amortisation_method,portal_type), end=' ')
id = "%s_%s_amortisation_details_view" % (country, amortisation_method) id = "%s_%s_amortisation_details_view" % (country, amortisation_method)
...@@ -22,8 +19,8 @@ def addAction(portal_type, portal_type_type, country, amortisation_method): ...@@ -22,8 +19,8 @@ def addAction(portal_type, portal_type_type, country, amortisation_method):
name = "Amortisation Details", name = "Amortisation Details",
action = action, action = action,
condition = "object/IsUsing%s%sAmortisationMethod" % ( condition = "object/IsUsing%s%sAmortisationMethod" % (
capitalize(country), country.capitalize(),
"".join([capitalize(x) for x in amortisation_method.split('_')]) ), "".join([x.capitalize() for x in amortisation_method.split('_')]) ),
permission = ('View',), permission = ('View',),
category = "object_view", category = "object_view",
visible = 1) visible = 1)
......
from string import capitalize
view_id_basis = "%s_%s_amortisation_method_view_details" view_id_basis = "%s_%s_amortisation_method_view_details"
view_action_basis = "Immobilisation_%s%sAmortisationMethodViewDetails" view_action_basis = "Immobilisation_%s%sAmortisationMethodViewDetails"
view_condition_basis = "object/Immobilisation_isUsing%s%sAmortisationMethod" view_condition_basis = "object/Immobilisation_isUsing%s%sAmortisationMethod"
...@@ -27,9 +25,9 @@ for method in amortisation_method_list: ...@@ -27,9 +25,9 @@ for method in amortisation_method_list:
exists = 1 exists = 1
if not exists: if not exists:
capitalized_id = "".join([capitalize(o) for o in id.split("_")]) capitalized_id = "".join([o.capitalize() for o in id.split("_")])
action_action = view_action_basis % (region, capitalized_id) action_action = view_action_basis % (region, capitalized_id)
action_condition = view_condition_basis % (capitalize(region),capitalized_id) action_condition = view_condition_basis % (region.capitalize(), capitalized_id)
context.addAction(id = action_id, context.addAction(id = action_id,
name = "Amortisation Details", name = "Amortisation Details",
action = action_action, action = action_action,
......
...@@ -252,14 +252,14 @@ ...@@ -252,14 +252,14 @@
<style:master-page style:name="Standard" style:page-layout-name="pm1"> <style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language()); <style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
orig_title string:Invoice; orig_title string:Invoice;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_page string:Page; orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8'); en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8'); my_page python: here.Base_translateString(orig_page);
orig_of string:of; orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8'); en_of python: here.Base_translateString(orig_of, lang=default_language);
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8'); my_of python: here.Base_translateString(orig_of);
image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or (data_dict['source_decision_image_path'] or data_dict['source_section_image_path']); image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or (data_dict['source_decision_image_path'] or data_dict['source_section_image_path']);
image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or (data_dict['source_decision_image_width'] or data_dict['source_section_image_width']); image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or (data_dict['source_decision_image_width'] or data_dict['source_section_image_width']);
image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or (data_dict['source_decision_image_height'] or data_dict['source_section_image_height'])"> image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or (data_dict['source_decision_image_height'] or data_dict['source_section_image_height'])">
......
...@@ -254,14 +254,14 @@ ...@@ -254,14 +254,14 @@
<style:master-page style:name="Standard" style:page-layout-name="pm1"> <style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language()); <style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
orig_title string:Invoice; orig_title string:Invoice;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_page string:Page; orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8'); en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8'); my_page python: here.Base_translateString(orig_page);
orig_of string:of; orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8'); en_of python: here.Base_translateString(orig_of, lang=default_language);
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8'); my_of python: here.Base_translateString(orig_of);
image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or (data_dict['source_decision_image_path'] or data_dict['source_section_image_path']); image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or (data_dict['source_decision_image_path'] or data_dict['source_section_image_path']);
image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or (data_dict['source_decision_image_width'] or data_dict['source_section_image_width']); image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or (data_dict['source_decision_image_width'] or data_dict['source_section_image_width']);
image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or (data_dict['source_decision_image_height'] or data_dict['source_section_image_height'])"> image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or (data_dict['source_decision_image_height'] or data_dict['source_section_image_height'])">
......
from six import string_types as basestring
toggable_pad = None toggable_pad = None
all_knowledge_pads = context.ERP5Site_getKnowledgePadListForUser(mode=mode) all_knowledge_pads = context.ERP5Site_getKnowledgePadListForUser(mode=mode)
if isinstance(knowledge_pad_url, basestring): if isinstance(knowledge_pad_url, basestring):
......
...@@ -249,14 +249,14 @@ ...@@ -249,14 +249,14 @@
<style:master-page style:name="Standard" style:page-layout-name="pm1"> <style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language()); <style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
orig_title string:Order; orig_title string:Order;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_page string:Page; orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8'); en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8'); my_page python: here.Base_translateString(orig_page);
orig_of string:of; orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8'); en_of python: here.Base_translateString(orig_of, lang=default_language);
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8'); my_of python: here.Base_translateString(orig_of);
image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or data_dict['source_decision_image_path']; image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or data_dict['source_decision_image_path'];
image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or data_dict['source_decision_image_width']; image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or data_dict['source_decision_image_width'];
image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or data_dict['source_decision_image_height']"> image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or data_dict['source_decision_image_height']">
......
...@@ -245,14 +245,14 @@ ...@@ -245,14 +245,14 @@
<office:master-styles> <office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1"> <style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header tal:define="orig_title string:Packing List; <style:header tal:define="orig_title string:Packing List;
en_title python: unicode(here.Base_translateString(orig_title, lang='en'), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang='en');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_page string:Page; orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang='en'), 'utf-8'); en_page python: here.Base_translateString(orig_page, lang='en');
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8'); my_page python: here.Base_translateString(orig_page);
orig_of string:of; orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang='en'), 'utf-8'); en_of python: here.Base_translateString(orig_of, lang='en');
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8'); my_of python: here.Base_translateString(orig_of);
image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or data_dict['source_section_image_path']; image_path python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_path'] or data_dict['source_section_image_path'];
image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or data_dict['source_section_image_width']; image_width python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_width'] or data_dict['source_section_image_width'];
image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or data_dict['source_section_image_height']"> image_height python: here.getPortalType().startswith('Purchase') and data_dict['destination_section_image_height'] or data_dict['source_section_image_height']">
......
...@@ -361,7 +361,7 @@ class _ERP5AuthorisationEndpoint(AuthorizationEndpoint): ...@@ -361,7 +361,7 @@ class _ERP5AuthorisationEndpoint(AuthorizationEndpoint):
for key, value in six.iteritems(request_info_dict): for key, value in six.iteritems(request_info_dict):
if value is None: if value is None:
continue continue
if not isinstance(value, basestring): if not isinstance(value, six.string_types):
raise TypeError((key, repr(value))) raise TypeError((key, repr(value)))
new_request_info_dict[key] = value new_request_info_dict[key] = value
inner_response = HTTPResponse(stdout=None, stderr=None) inner_response = HTTPResponse(stdout=None, stderr=None)
...@@ -857,7 +857,7 @@ def _callEndpoint(endpoint, self, REQUEST): ...@@ -857,7 +857,7 @@ def _callEndpoint(endpoint, self, REQUEST):
request_body = urllib.urlencode([ request_body = urllib.urlencode([
(x, y) (x, y)
for x, y in six.iteritems(REQUEST.form) for x, y in six.iteritems(REQUEST.form)
if isinstance(y, basestring) if isinstance(y, six.string_types)
]) ])
uri = other.get('URL', '') uri = other.get('URL', '')
query_string = environ.get('QUERY_STRING') query_string = environ.get('QUERY_STRING')
......
...@@ -9,11 +9,8 @@ def _getFacebookClientIdAndSecretKey(portal, reference="default"): ...@@ -9,11 +9,8 @@ def _getFacebookClientIdAndSecretKey(portal, reference="default"):
Internal function. Internal function.
""" """
result_list = unrestrictedSearchFacebookConnector(portal, reference=reference) facebook_connector = unrestrictedSearchFacebookConnector(portal, reference=reference)
assert result_list, "Facebook Connector not found" assert facebook_connector, "Facebook Connector not found"
if len(result_list) == 2:
raise ValueError("Impossible to select one Facebook Connector")
facebook_connector = result_list[0]
return facebook_connector.getClientId(), facebook_connector.getSecretKey() return facebook_connector.getClientId(), facebook_connector.getSecretKey()
def redirectToFacebookLoginPage(self, came_from=None): def redirectToFacebookLoginPage(self, came_from=None):
...@@ -34,11 +31,18 @@ def getAccessTokenFromCode(self, code, redirect_uri): ...@@ -34,11 +31,18 @@ def getAccessTokenFromCode(self, code, redirect_uri):
app_id=client_id, app_secret=secret_key) app_id=client_id, app_secret=secret_key)
def unrestrictedSearchFacebookConnector(self, reference="default"): def unrestrictedSearchFacebookConnector(self, reference="default"):
return self.getPortalObject().portal_catalog.unrestrictedSearchResults( result_list = self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type="Facebook Connector", portal_type="Facebook Connector",
reference=reference, reference=reference,
validation_state="validated", validation_state="validated",
limit=2) limit=2)
if not result_list:
return
if len(result_list) != 1:
raise ValueError('Impossible to select Facebook Connector')
return result_list[0].getObject()
def unrestrictedSearchFacebookLogin(self, login, REQUEST=None): def unrestrictedSearchFacebookLogin(self, login, REQUEST=None):
if REQUEST is not None: if REQUEST is not None:
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Site_getFacebookConnector</string> </value> <value> <string>ERP5Site_getDefaultFacebookConnector</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -4,6 +4,9 @@ result_list = portal.portal_catalog( ...@@ -4,6 +4,9 @@ result_list = portal.portal_catalog(
reference=reference, reference=reference,
validation_state="validated", validation_state="validated",
limit=2) limit=2)
if not result_list:
return
if len(result_list) != 1: if len(result_list) != 1:
raise ValueError("Impossible to select one Google Connector") raise ValueError("Impossible to select one Google Connector")
return result_list[0].getObject() return result_list[0].getObject()
...@@ -60,13 +60,16 @@ class GoogleLoginTestCase(ERP5TypeTestCase): ...@@ -60,13 +60,16 @@ class GoogleLoginTestCase(ERP5TypeTestCase):
).validate() ).validate()
self.default_user_person.newContent(portal_type='Assignment').open() self.default_user_person.newContent(portal_type='Assignment').open()
if getattr(self.portal.portal_oauth, self.dummy_connector_id, None) is None: connector = getattr(self.portal.portal_oauth, self.dummy_connector_id, None)
if connector is None:
connector = self.portal.portal_oauth.newContent( connector = self.portal.portal_oauth.newContent(
id=self.dummy_connector_id, id=self.dummy_connector_id,
portal_type="Google Connector", portal_type="Google Connector",
reference="default", reference="default",
client_id=self.client_id, client_id=self.client_id,
secret_key=self.secret_key) secret_key=self.secret_key)
if connector.getValidationState() != "validated":
connector.validate() connector.validate()
self.tic() self.tic()
...@@ -416,6 +419,22 @@ class TestERP5JSGoogleLogin(GoogleLoginTestCase): ...@@ -416,6 +419,22 @@ class TestERP5JSGoogleLogin(GoogleLoginTestCase):
self.assertEqual(resp.getStatus(), six.moves.http_client.FOUND) self.assertEqual(resp.getStatus(), six.moves.http_client.FOUND)
self.assertIn('google.com', resp.getHeader('Location')) self.assertIn('google.com', resp.getHeader('Location'))
def test_login_form_not_configured(self):
connector = getattr(self.portal.portal_oauth, self.dummy_connector_id, None)
if connector is not None:
if connector.getValidationState() == "validated":
connector.invalidate()
self.tic()
resp = self.publish(self._getWebSite().getPath() + '/login_form')
tree = lxml.etree.fromstring(resp.getBody(), parser=lxml.etree.HTMLParser())
self.assertEqual([], [
img.getparent().attrib['href']
for img in tree.findall('.//a/img')
if img.attrib['alt'] == 'Sign in with Google'
])
def test_logout(self): def test_logout(self):
resp = self.publish(self._getWebSite().getPath() + '/WebSite_logout') resp = self.publish(self._getWebSite().getPath() + '/WebSite_logout')
self.assertEqual(resp.getCookie("__ac_google_hash")['value'], 'deleted') self.assertEqual(resp.getCookie("__ac_google_hash")['value'], 'deleted')
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
serie.drawPoints = true; serie.drawPoints = true;
serie.strokeWidth = 0; serie.strokeWidth = 0;
} }
console.log("serie", serie);
graph_data_and_parameter.series[trace.title || ''] = serie; graph_data_and_parameter.series[trace.title || ''] = serie;
} }
for (i = 0; i < data.length; i = i + 1) { for (i = 0; i < data.length; i = i + 1) {
...@@ -195,7 +194,11 @@ ...@@ -195,7 +194,11 @@
graph_data_and_parameter; graph_data_and_parameter;
container = gadget.element.querySelector(".graph-content"); container = gadget.element.querySelector(".graph-content");
if (modification_dict.value.new_format) {
graph_data_and_parameter = formatGraphDict(modification_dict.value); graph_data_and_parameter = formatGraphDict(modification_dict.value);
} else {
graph_data_and_parameter = getGraphDataAndParameterFromConfiguration(modification_dict.value);
}
gadget.property_dict.graph = new Dygraph(container, gadget.property_dict.graph = new Dygraph(container,
graph_data_and_parameter.dygraph_data, graph_data_and_parameter.dygraph_data,
graph_data_and_parameter.dygraph_parameter_dict); graph_data_and_parameter.dygraph_parameter_dict);
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1016.32471.45294.12919</string> </value> <value> <string>1016.58116.20617.24900</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1715371703.99</float> <float>1716991783.66</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -60,12 +60,12 @@ if not zip_file: ...@@ -60,12 +60,12 @@ if not zip_file:
rejectSoftwarePublication(software_publication) rejectSoftwarePublication(software_publication)
return return
from cStringIO import StringIO from io import BytesIO
import zipfile import zipfile
from zipfile import BadZipfile from zipfile import BadZipfile
zipbuffer = StringIO() zipbuffer = BytesIO()
zipbuffer.write(str(zip_file.getData())) zipbuffer.write(bytes(zip_file.getData()))
try: try:
zip_reader = zipfile.ZipFile(zipbuffer) zip_reader = zipfile.ZipFile(zipbuffer)
except BadZipfile: except BadZipfile:
......
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
(function (window, rJS) { (function (window, rJS) {
"use strict"; "use strict";
function updateResourceListField(gadget) {
var selectedProject = gadget.element.querySelector('#field_your_project').value;
return gadget.jio_getAttachment(
'support_request_module',
gadget.hateoas_url + 'support_request_module'
+ "/SupportRequest_getSupportTypeList"
+ "?project_id=" + selectedProject + "&json_flag=True"
).push(function (sp_list) {
var i, j,
sp_select = gadget.element.querySelector('#field_your_resource');
for (i = sp_select.options.length - 1; i >= 0; i -= 1) {
sp_select.remove(i);
}
for (j = 0; j < sp_list.length; j += 1) {
sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]);
}
if (sp_select.options.length === 2) {
sp_select.selectedIndex = 1;
}
});
}
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Acquired methods // Acquired methods
...@@ -41,40 +64,22 @@ ...@@ -41,40 +64,22 @@
}) })
.push(function (hateoas_url) { .push(function (hateoas_url) {
gadget.hateoas_url = hateoas_url; gadget.hateoas_url = hateoas_url;
}).push(function () { // Do it synchronously, to ensure the full form
gadget.updateResourceListField(); // will be displayed only when the select field has the expected
// values
return updateResourceListField(gadget);
}); });
}) })
.declareMethod('triggerSubmit', function () { .declareMethod('triggerSubmit', function () {
return this.form.triggerSubmit(); return this.form.triggerSubmit();
}) })
.declareJob('updateResourceListField', function () { .declareJob('deferUpdateResourceListField', function () {
var gadget = this, return updateResourceListField(this);
selectedProject = document.getElementById('field_your_project').value;
return gadget.jio_getAttachment(
'support_request_module',
gadget.hateoas_url + 'support_request_module'
+ "/SupportRequest_getSupportTypeList"
+ "?project_id=" + selectedProject + "&json_flag=True"
).push(function (sp_list) {
var i, j,
sp_select = document.getElementById('field_your_resource');
for (i = sp_select.options.length - 1; i >= 0; i -= 1) {
sp_select.remove(i);
}
for (j = 0; j < sp_list.length; j += 1) {
sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]);
}
if (sp_select.options.length === 2) {
sp_select.selectedIndex = 1;
}
});
}) })
.onEvent('change', function (evt) { .onEvent('change', function (evt) {
var gadget = this; var gadget = this;
if (evt.target.id === "field_your_project") { if (evt.target.id === "field_your_project") {
gadget.updateResourceListField(); gadget.deferUpdateResourceListField();
} }
}, false, false); }, false, false);
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -69,7 +69,9 @@ ...@@ -69,7 +69,9 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
...@@ -244,7 +246,7 @@ ...@@ -244,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.26853.29747.36369</string> </value> <value> <string>1017.45366.38938.62225</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,8 +266,8 @@ ...@@ -264,8 +266,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1607511772.32</float> <float>1719991591.9</float>
<string>GMT+1</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>zzz_logout_test</string> </value> <value> <string>officejs_support_request_ui_logout_zuite</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>translation_zuite</string> </value> <value> <string>officejs_support_request_ui_translation_zuite</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -71,6 +71,11 @@ ...@@ -71,6 +71,11 @@
<td>field_your_project</td> <td>field_your_project</td>
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text()="FeatureRequire"]</td> <td>//select[@name="field_your_resource"]/option[text()="FeatureRequire"]</td>
......
...@@ -34,8 +34,23 @@ ...@@ -34,8 +34,23 @@
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForElementNotPresent</td>
<td>FeatureRequire</td> <td>//option[text()="BugReport"]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//option[text()="BugReport"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//option[text()="FeatureRequire"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//option[text()="FeatureRequire"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
<td>field_your_project</td> <td>field_your_project</td>
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>FeatureRequire</td> <td>FeatureRequire</td>
......
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
<td>field_your_project</td> <td>field_your_project</td>
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>FeatureRequire</td> <td>FeatureRequire</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td> <td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
<td>10000</td> <td>10000</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
</tbody></table> </tbody></table>
</body> </body>
......
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
<td>field_your_project</td> <td>field_your_project</td>
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>FeatureRequire</td> <td>FeatureRequire</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<tr><td>open</td> <tr><td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td><td></td></tr> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- reset filter is disabled --> <!-- reset filter is disabled -->
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<tr><td>open</td> <tr><td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td><td></td></tr> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- reset filter is disabled --> <!-- reset filter is disabled -->
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td> <td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td> <td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
...@@ -28,35 +28,29 @@ ...@@ -28,35 +28,29 @@
<tr><td>type</td> <tr><td>type</td>
<td>//input[@name='field_your_title']</td> <td>//input[@name='field_your_title']</td>
<td>testLatestPostOnFrontPage</td></tr> <td>testLatestPostOnFrontPage</td></tr>
<!-- Wait for the gadget to update the resource according to the project type,
this done by an ajax call.-->
<tr>
<td>waitForElementPresent</td>
<td>//option[@text="BugReport"]</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//option[@text="BugReport"]</td>
</tr>
<tr><td>select</td> <tr><td>select</td>
<td>field_your_project</td> <td>field_your_project</td>
<td>RobotMaking</td> <td>RobotMaking</td>
</tr> </tr>
<tr> <tr>
<td>waitForElementNotPresent</td> <td>waitForElementNotPresent</td>
<td>//option[@text="BugReport"]</td> <td>//option[text()="BugReport"]</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementNotPresent</td> <td>assertElementNotPresent</td>
<td>//option[@text="BugReport"]</td> <td>//option[text()="BugReport"]</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//option[@text="FeatureRequire"]</td> <td>//option[text()="FeatureRequire"]</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//option[@text="FeatureRequire"]</td> <td>//option[text()="FeatureRequire"]</td>
<td></td>
</tr> </tr>
<tr><td>select</td> <tr><td>select</td>
<td>field_your_resource</td> <td>field_your_resource</td>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[contains(@class, "ui-icon-life-ring") and text() = "Support Requests"]</td> <td>//a[contains(@class, "ui-icon-life-ring") and text() = "Support Requests"]</td>
...@@ -45,6 +46,8 @@ ...@@ -45,6 +46,8 @@
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr> <tr>
<td>type</td> <td>type</td>
<td>//div[@role="main"]//div[@data-gadget-url="${base_url}/web_site_module/erp5_officejs_support_request_ui/gadget_erp5_searchfield.html"]//input[@name="search"]</td> <td>//div[@role="main"]//div[@data-gadget-url="${base_url}/web_site_module/erp5_officejs_support_request_ui/gadget_erp5_searchfield.html"]//input[@name="search"]</td>
...@@ -55,6 +58,8 @@ ...@@ -55,6 +58,8 @@
<td>//div[@role="main"]//div[@data-gadget-url="${base_url}/web_site_module/erp5_officejs_support_request_ui/gadget_erp5_searchfield.html"]//button[@type="submit"]</td> <td>//div[@role="main"]//div[@data-gadget-url="${base_url}/web_site_module/erp5_officejs_support_request_ui/gadget_erp5_searchfield.html"]//button[@type="submit"]</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@class="document_table"]/table/tbody/tr/td[1]/a[contains(text(), "123dsfa")]</td> <td>//div[@class="document_table"]/table/tbody/tr/td[1]/a[contains(text(), "123dsfa")]</td>
......
##############################################################################
#
# Copyright (c) 2002-2017 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestSupportRequestUILogout(ERP5TypeFunctionalTestCase):
run_only = "officejs_support_request_ui_logout_zuite"
def afterSetUp(self):
super(TestSupportRequestUILogout, self).afterSetUp()
# fix consistency to update translation
self.portal.web_site_module.erp5_officejs_support_request_ui.fixConsistency()
self.tic()
del ERP5TypeFunctionalTestCase
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testFunctionalSupportRequestLogout</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalSupportRequestLogout</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Support Request UI tests</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
##############################################################################
#
# Copyright (c) 2002-2017 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestSupportRequestUITranslation(ERP5TypeFunctionalTestCase):
run_only = "officejs_support_request_ui_translation_zuite"
def afterSetUp(self):
super(TestSupportRequestUITranslation, self).afterSetUp()
# fix consistency to update translation
self.portal.web_site_module.erp5_officejs_support_request_ui.fixConsistency()
self.tic()
del ERP5TypeFunctionalTestCase
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testFunctionalSupportRequestTranslation</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalSupportRequestTranslation</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Support Request UI tests</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -5,6 +5,10 @@ person_module/erp5_officejs_support_request_ui_test_person_002 ...@@ -5,6 +5,10 @@ person_module/erp5_officejs_support_request_ui_test_person_002
portal_categories/use/crm portal_categories/use/crm
portal_categories/use/crm/event portal_categories/use/crm/event
portal_categories/use/crm/support_request portal_categories/use/crm/support_request
portal_tests/officejs_support_request_ui_logout_zuite
portal_tests/officejs_support_request_ui_logout_zuite/**
portal_tests/officejs_support_request_ui_translation_zuite
portal_tests/officejs_support_request_ui_translation_zuite/**
portal_tests/officejs_support_request_ui_zuite portal_tests/officejs_support_request_ui_zuite
portal_tests/officejs_support_request_ui_zuite/** portal_tests/officejs_support_request_ui_zuite/**
project_module/erp5_officejs_support_request_ui_test_project_001 project_module/erp5_officejs_support_request_ui_test_project_001
......
test.erp5.testFunctionalSupportRequest test.erp5.testFunctionalSupportRequest
test.erp5.testFunctionalSupportRequestLogout
test.erp5.testFunctionalSupportRequestTranslation
test.erp5.testSupportRequest test.erp5.testSupportRequest
\ No newline at end of file
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
num = 0 num = 0
...@@ -20,8 +19,8 @@ for [method_id, result] in result_list: ...@@ -20,8 +19,8 @@ for [method_id, result] in result_list:
int_len = 7 int_len = 7
if not result['success']: if not result['success']:
o = newTempBase(portal_object, safe_id) o = newTempBase(portal_object, safe_id)
o.setUid( 'new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.setUid( 'new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit(uid='new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.edit(uid='new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit(**result['object']) o.edit(**result['object'])
result_listbox.append(o) result_listbox.append(o)
......
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
num = 0 num = 0
...@@ -25,8 +24,8 @@ for [method_id, result] in result_list: ...@@ -25,8 +24,8 @@ for [method_id, result] in result_list:
num += 1 num += 1
int_len = 3 int_len = 3
o = newTempBase(portal_object, safe_id) o = newTempBase(portal_object, safe_id)
o.setUid( 'new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.setUid( 'new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit(uid='new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.edit(uid='new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit( method_id = method_id o.edit( method_id = method_id
, result = result['message'] , result = result['message']
, object_url = result['object_url'] , object_url = result['object_url']
......
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill
num = 0 num = 0
listbox_lines = [] listbox_lines = []
...@@ -23,8 +22,8 @@ for spreadsheet in spreadsheets.keys(): ...@@ -23,8 +22,8 @@ for spreadsheet in spreadsheets.keys():
# int_len is used to fill the uid of the created object like 0000001 # int_len is used to fill the uid of the created object like 0000001
int_len = 7 int_len = 7
o = newTempBase(context, safe_id) o = newTempBase(context, safe_id)
o.setUid('new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.setUid('new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit(uid='new_%s' % zfill(num, int_len)) # XXX There is a security issue here o.edit(uid='new_%s' % str(num).zfill(int_len)) # XXX There is a security issue here
o.edit( o.edit(
id=safe_id, id=safe_id,
spreadsheet_name=spreadsheet, spreadsheet_name=spreadsheet,
......
...@@ -262,15 +262,15 @@ ...@@ -262,15 +262,15 @@
<tal:block define=" <tal:block define="
date_renderer nocall:here/Base_viewFieldLibrary/my_date/render_pdf; date_renderer nocall:here/Base_viewFieldLibrary/my_date/render_pdf;
orig_title python: 'Payslip'; orig_title python: 'Payslip';
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_period python: 'From ${start_date} to ${stop_date}'; orig_period python: 'From ${start_date} to ${stop_date}';
en_period python: unicode(here.Base_translateString(orig_period, lang=default_language, en_period python: here.Base_translateString(orig_period, lang=default_language,
mapping = {'start_date': date_renderer(pay_sheet_transaction.getStartDate()), mapping = {'start_date': date_renderer(pay_sheet_transaction.getStartDate()),
'stop_date': date_renderer(pay_sheet_transaction.getStopDate())}), 'utf-8'); 'stop_date': date_renderer(pay_sheet_transaction.getStopDate())});
my_period python: unicode(here.Base_translateString(orig_period, my_period python: here.Base_translateString(orig_period,
mapping = {'start_date': date_renderer(pay_sheet_transaction.getStartDate()), mapping = {'start_date': date_renderer(pay_sheet_transaction.getStartDate()),
'stop_date': date_renderer(pay_sheet_transaction.getStopDate())}), 'utf-8'); 'stop_date': date_renderer(pay_sheet_transaction.getStopDate())});
image_path python: data_dict['destination_section_image_path']; image_path python: data_dict['destination_section_image_path'];
image_width python: data_dict['destination_section_image_width']; image_width python: data_dict['destination_section_image_width'];
image_height python: data_dict['destination_section_image_height']"> image_height python: data_dict['destination_section_image_height']">
...@@ -404,27 +404,27 @@ ...@@ -404,27 +404,27 @@
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
<table:table-row> <table:table-row>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Designation; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Designation; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Base; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Base; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share Rate; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share Rate; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share Rate; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share Rate; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
...@@ -631,7 +631,7 @@ ...@@ -631,7 +631,7 @@
<table:table-cell table:style-name='Tableau3.A1' office:value-type='string'> <table:table-cell table:style-name='Tableau3.A1' office:value-type='string'>
<text:p text:style-name='Table_20_Contents'/> <text:p text:style-name='Table_20_Contents'/>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau3.D2' office:value-type='string' tal:define='orig_string string:Net payable; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau3.D2' office:value-type='string' tal:define='orig_string string:Net payable; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Table_20_Heading'><span tal:replace='orig_message'/>:</text:p> <text:p text:style-name='Table_20_Heading'><span tal:replace='orig_message'/>:</text:p>
<text:p text:style-name='Table_20_Heading' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p> <text:p text:style-name='Table_20_Heading' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p>
</table:table-cell> </table:table-cell>
......
...@@ -329,27 +329,27 @@ ...@@ -329,27 +329,27 @@
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
<table:table-row> <table:table-row>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Designation; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Designation; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Base; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Base; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share Rate; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share Rate; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employee Share; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share Rate; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share Rate; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A2' office:value-type='string' tal:define='orig_string string:Employer Share; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title_20_Left' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
...@@ -556,7 +556,7 @@ ...@@ -556,7 +556,7 @@
<table:table-cell table:style-name='Tableau3.A1' office:value-type='string'> <table:table-cell table:style-name='Tableau3.A1' office:value-type='string'>
<text:p text:style-name='Table_20_Contents'/> <text:p text:style-name='Table_20_Contents'/>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau3.D2' office:value-type='string' tal:define='orig_string string:Net payable; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau3.D2' office:value-type='string' tal:define='orig_string string:Net payable; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python:here.Base_translateString(orig_string)'>
<text:p text:style-name='Table_20_Heading'><span tal:replace='orig_message'/>:</text:p> <text:p text:style-name='Table_20_Heading'><span tal:replace='orig_message'/>:</text:p>
<text:p text:style-name='Table_20_Heading' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p> <text:p text:style-name='Table_20_Heading' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p>
</table:table-cell> </table:table-cell>
......
...@@ -260,15 +260,15 @@ ...@@ -260,15 +260,15 @@
<style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language()); <style:header tal:define="default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
date_renderer nocall:here/Base_viewFieldLibrary/my_date_time_field/render_pdf; date_renderer nocall:here/Base_viewFieldLibrary/my_date_time_field/render_pdf;
orig_title python: 'Payslip'; orig_title python: 'Payslip';
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8'); en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8'); my_title python: here.Base_translateString(orig_title);
orig_period python: 'From ${start_date} to ${stop_date}'; orig_period python: 'From ${start_date} to ${stop_date}';
en_period python: unicode(here.Base_translateString(orig_period, lang=default_language, en_period python: here.Base_translateString(orig_period, lang=default_language,
mapping = {'start_date': date_renderer(here.getStartDate()), mapping = {'start_date': date_renderer(here.getStartDate()),
'stop_date': date_renderer(here.getStopDate())}), 'utf-8'); 'stop_date': date_renderer(here.getStopDate())});
my_period python: unicode(here.Base_translateString(orig_period, my_period python: here.Base_translateString(orig_period,
mapping = {'start_date': date_renderer(here.getStartDate()), mapping = {'start_date': date_renderer(here.getStartDate()),
'stop_date': date_renderer(here.getStopDate())}), 'utf-8'); 'stop_date': date_renderer(here.getStopDate())});
image_path python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_path'] or data_dict['destination_section_image_path']; image_path python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_path'] or data_dict['destination_section_image_path'];
image_width python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_width'] or data_dict['destination_section_image_width']; image_width python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_width'] or data_dict['destination_section_image_width'];
image_height python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_height'] or data_dict['destination_section_image_height']"> image_height python: here.getPortalType().startswith('Pay Sheet Transaction') and data_dict['destination_section_image_height'] or data_dict['destination_section_image_height']">
......
...@@ -30,7 +30,7 @@ macro is found. It's used to display description field --> ...@@ -30,7 +30,7 @@ macro is found. It's used to display description field -->
xmlns:metal='http://xml.zope.org/namespaces/metal'> xmlns:metal='http://xml.zope.org/namespaces/metal'>
<tal:block metal:define-macro="other_informations"> <tal:block metal:define-macro="other_informations">
<table:table-row table:style-name='Tableau3.6'> <table:table-row table:style-name='Tableau3.6'>
<table:table-cell table:style-name='Tableau3.A6' office:value-type='string' tal:define='orig_string string:Notes; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau3.A6' office:value-type='string' tal:define='orig_string string:Notes; orig_message python:here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='P2'><span tal:replace='orig_message'/> <text:p text:style-name='P2'><span tal:replace='orig_message'/>
<span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p> <span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p>
</table:table-cell> </table:table-cell>
......
...@@ -142,27 +142,27 @@ ...@@ -142,27 +142,27 @@
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
<table:table-row> <table:table-row>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Gross Salary; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Gross Salary; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Tranche A; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Tranche A; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Heures Normales; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Heures Normales; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Heures supp.; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Heures supp.; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Cotisations patronales; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Cotisations patronales; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Net Imposable.; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau1.A6' office:value-type='string' tal:define='orig_string string:Net Imposable.; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title'><span tal:replace='orig_message'/></text:p>
<text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p> <text:p text:style-name='Item_20_Table_20_Title' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell> </table:table-cell>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
<table:table-row table:style-name='Tableau3.6' tal:condition="data_dict/description"> <table:table-row table:style-name='Tableau3.6' tal:condition="data_dict/description">
<table:table-cell table:style-name='Tableau3.A6' office:value-type='string' tal:define='orig_string string:Notes; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")'> <table:table-cell table:style-name='Tableau3.A6' office:value-type='string' tal:define='orig_string string:Notes; orig_message python: here.Base_translateString(orig_string, lang=default_language); translated_message python: here.Base_translateString(orig_string)'>
<text:p text:style-name='P2'><span tal:replace='orig_message'/> <text:p text:style-name='P2'><span tal:replace='orig_message'/>
<span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p> <span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p>
</table:table-cell> </table:table-cell>
......
...@@ -11,8 +11,8 @@ for item in item_list: ...@@ -11,8 +11,8 @@ for item in item_list:
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
item_split = string.split(item_value, '/') item_split = item_value.split('/')
item_key = string.join(item_split[:split_depth] , '/' ) item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0] base_category = item_split[0]
if item_key not in sub_field_dict: if item_key not in sub_field_dict:
# Create property dict # Create property dict
......
...@@ -11,8 +11,8 @@ for item in item_list: ...@@ -11,8 +11,8 @@ for item in item_list:
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
item_split = string.split(item_value, '/') item_split = item_value.split('/')
item_key = string.join(item_split[:split_depth] , '/' ) item_key = '/'.join(item_split[:split_depth])
if item_key not in sub_field_dict: if item_key not in sub_field_dict:
# Create property dict # Create property dict
......
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
...@@ -15,7 +14,7 @@ def createInputLine(new_id): ...@@ -15,7 +14,7 @@ def createInputLine(new_id):
int_len = 3 int_len = 3
o = newTempBase( portal_object, o = newTempBase( portal_object,
str(new_id), str(new_id),
uid ='new_%s' % zfill(new_id, int_len) uid ='new_%s' % str(new_id).zfill(int_len)
) )
l.append(o) l.append(o)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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