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
portal = context.getPortalObject()
active_process = portal.restrictedTraverse(active_process)
......@@ -12,7 +13,7 @@ if result_list:
journal_lib=journal_lib,
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
this_journal_active_process.getParentValue().manage_delObjects(ids=[this_journal_active_process.getId()])
......@@ -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">
<exercice>
<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>
</comptabilite>
\ No newline at end of file
<journal xmlns:tal="http://xml.zope.org/namespaces/tal">
<JournalCode tal:content="options/journal_code"></JournalCode>
<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>
\ No newline at end of file
......@@ -2,6 +2,7 @@
active result.
We need a proxy role to post the result.
"""
import zlib
from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject()
......@@ -12,10 +13,10 @@ if context.getSourceSectionUid() in section_uid_list:
if any([line.getSource(portal_type='Account') for line in accounting_line_list]):
source_xml = context.AccountingTransaction_viewAsSourceFECXML(
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 any([line.getDestination(portal_type='Account') for line in accounting_line_list]):
destination_xml = context.AccountingTransaction_viewAsDestinationFECXML(
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 @@
##############################################################################
import os
from string import zfill
from urllib import urlencode
import tempfile
from DateTime import DateTime
......@@ -82,14 +81,14 @@ def printBarcodeSheet(self, sheet_number=1, input_list=[], test=False):
tempfile.tempdir = tempdir
if test:
#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):
if not isinstance(input_list, list):
input_list = os.linesep.join(map(escapeString, input_list.split(os.linesep)))
else:
input_list = os.linesep.join(input_list)
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)
ret = os.system(text_command)
if ret != 0:
......
from string import zfill
return zfill(context.portal_ids.getLastGeneratedId(id_group='barcode'),12)
return str(context.portal_ids.getLastGeneratedId(id_group='barcode')).zfill(12)
......@@ -32,8 +32,7 @@
import os
import subprocess
from cStringIO import StringIO
from io import BytesIO
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
......@@ -117,7 +116,7 @@ class Image(TextConvertableMixin, File, OFSImage):
content_type, width, height = getImageInfo(self.data)
if not content_type:
try:
image = PIL.Image.open(StringIO(str(self.data)))
image = PIL.Image.open(BytesIO(bytes(self.data)))
except IOError:
width = height = -1
content_type = 'application/unknown'
......@@ -381,7 +380,7 @@ class Image(TextConvertableMixin, File, OFSImage):
else:
parameter_list.append('-')
data = str(self.getData())
data = bytes(self.getData())
if self.getContentType() == "image/svg+xml":
data = transformUrlToDataURI(data)
......@@ -401,7 +400,7 @@ class Image(TextConvertableMixin, File, OFSImage):
finally:
del process
if image:
return StringIO(image)
return BytesIO(image)
raise ConversionError('Image conversion failed (%s).' % err)
def _getContentTypeAndImageData(
......
......@@ -27,7 +27,8 @@
#
##############################################################################
import re, zipfile, cStringIO
import re, zipfile
from io import BytesIO
from warnings import warn
from AccessControl import ClassSecurityInfo
from OFS.Image import Pdata
......@@ -38,7 +39,7 @@ from Products.ERP5Type.Cache import CachingMethod
from erp5.component.document.File import File
from erp5.component.document.Document import Document, \
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
from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin
......@@ -198,10 +199,10 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
raise NotConvertedError()
if format == 'text-content':
# Extract text from the ODF file
cs = cStringIO.StringIO()
cs.write(str(self.getBaseData()))
cs = BytesIO()
cs.write(self.getBaseData())
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_compr.sub(" ", s) # compress multiple spaces
cs.close()
......@@ -210,7 +211,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self)
orig_format = self.getBaseContentType()
generate_result = server_proxy.run_generate(self.getId(),
enc(str(self.getBaseData())),
bytes2str(enc(bytes(self.getBaseData()))),
None,
format,
orig_format)
......@@ -222,7 +223,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
response_dict = generate_result
# 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
def _convert(self, format, frame=0, **kw): # pylint: disable=redefined-builtin
......@@ -258,7 +259,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
original_format = format
allowed_format_list = self.getTargetFormatList()
if format == 'base-data':
return self.getBaseContentType(), str(self.getBaseData())
return self.getBaseContentType(), self.getBaseData()
if format == 'pdf':
format_list = [x for x in allowed_format_list
if x.endswith('pdf')]
......@@ -301,8 +302,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
if is_html:
# Extra processing required since
# we receive a zip file
cs = cStringIO.StringIO()
cs.write(str(data))
cs = BytesIO()
cs.write(bytes(data)) # Cast explicitly to bytes for possible Pdata
z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient
for f in z.infolist():
fn = f.filename
......@@ -324,7 +325,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
# create temporary image and use it to resize accordingly
temp_image = self.portal_contributions.newContent(
portal_type='Image',
file=cStringIO.StringIO(),
file=BytesIO(),
filename=self.getId(),
temp_object=1)
temp_image._setData(data)
......@@ -346,8 +347,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
format_list = [x for x in self.getTargetFormatList()
if x.startswith('html') or x.endswith('html')]
mime, data = self._getConversionFromProxyServer(format_list[0])
archive_file = cStringIO.StringIO()
archive_file.write(str(data))
archive_file = BytesIO()
archive_file.write(data)
zip_file = zipfile.ZipFile(archive_file)
must_close = 1
else:
......@@ -384,13 +385,13 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self)
response_code, response_dict, response_message = server_proxy.run_convert(
self.getFilename() or self.getId(),
enc(str(self.getData())),
bytes2str(enc(bytes(self.getData()))),
None,
None,
self.getContentType())
if response_code == 200:
# sucessfully converted document
self._setBaseData(dec(response_dict['data']))
self._setBaseData(dec(str2bytes(response_dict['data'])))
metadata = response_dict['meta']
self._base_metadata = metadata
if metadata.get('MIMEType', None) is not None:
......@@ -423,11 +424,11 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
server_proxy = DocumentConversionServerProxy(self)
response_code, response_dict, response_message = \
server_proxy.run_setmetadata(self.getId(),
enc(str(self.getBaseData())),
bytes2str(enc(bytes(self.getBaseData()))),
kw)
if response_code == 200:
# 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.
else:
# 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):
# huBarcode's DataMatrix support has limitation for data size.
# huBarcode's QRCode support is broken.
# more 1-D barcode types can be added by pyBarcode library.
# type: (str, str, HTTPRequest) -> bytes
barcode_type = barcode_type.lower()
if barcode_type == 'datamatrix':
from subprocess import Popen, PIPE
......@@ -10,26 +13,51 @@ def generateBarcodeImage(self, barcode_type, data, REQUEST=None):
stdout=PIPE,
stderr=PIPE,
close_fds=True)
output, _ = process.communicate(input=data)
output, _ = process.communicate(input=str2bytes(data))
elif barcode_type == 'ean13':
from hubarcode.ean13 import EAN13Encoder
encoder = EAN13Encoder(data)
output = encoder.get_imagedata()
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
encoder = EAN13Encoder(data)
output = encoder.get_imagedata()
elif barcode_type == 'code128':
from hubarcode.code128 import Code128Encoder
encoder = Code128Encoder(data)
encoder.text = '' # get barcode image only
output = encoder.get_imagedata()
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
encoder = Code128Encoder(data)
encoder.text = '' # get barcode image only
output = encoder.get_imagedata()
elif barcode_type == 'qrcode':
import qrcode
from cStringIO import StringIO
fp = StringIO()
img = qrcode.make(data)
fp = io.BytesIO()
img = qrcode.make(str2bytes(data))
img.save(fp, 'png')
fp.seek(0)
output = fp.read()
output = fp.getvalue()
else:
raise NotImplementedError('barcode_type=%s is not supported' % barcode_type)
if REQUEST is not None:
REQUEST.RESPONSE.setHeader('Content-Type', 'image/png')
return output
# pylint:enable=import-error
......@@ -38,6 +38,7 @@ from erp5.component.interface.IEncryptedPassword import IEncryptedPassword
from Products.ERP5Type.Globals import PersistentMapping
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.exceptions import AccessControl_Unauthorized
from six import string_types as basestring
@zope.interface.implementer(IEncryptedPassword,)
class EncryptedPasswordMixin(object):
......
......@@ -29,6 +29,8 @@
import urllib2
from lxml import etree
from erp5.component.document.Document import ConversionError
import base64
from Products.ERP5Type.Utils import bytes2str
SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg"
......@@ -38,7 +40,7 @@ def getDataURI(url):
except Exception as 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"],
data.read().encode("base64").replace('\n', ""))
bytes2str(base64.b64encode(data.read())).replace('\n', ""))
def transformUrlToDataURI(content):
if content is None or len(content) == 0:
......
......@@ -35,8 +35,8 @@ for item in item_list:
item_value = item[int(not is_right_display)]
# Hash key from item_value
item_split = string.split(item_value, '/')
item_key = string.join(item_split[:split_depth] , '/' )
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0]
multi = True
......
......@@ -30,8 +30,8 @@ for item in item_list:
item_value = item[int(not is_right_display)]
# Hash key from item_value
item_split = string.split(item_value, '/')
item_key = string.join(item_split[:split_depth] , '/' )
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0]
multi = False # XXX or now budget level are only single value.
......
......@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Message import translateString
from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin
from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
from six import string_types as basestring
@zope.interface.implementer(IConfiguratorItem)
class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
......
from string import zfill
##################################################
#### About the transformation_rules structure ####
# 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 ####
# 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:
for second_level in structured_input_data[upper_level_key][1]:
second_level_id += 10
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():
new_2nd_level_obj.setProperty(property_title, second_level[property_title])
......
from Products.ERP5Type.Document import newTempBase
from string import zfill
global portal_object, new_id, l
......@@ -14,7 +13,7 @@ def createInputLine():
int_len = 3
o = newTempBase( portal_object
, str(new_id)
, uid ='new_%s' % zfill(new_id, int_len)
, uid ='new_%s' % str(new_id).zfill(int_len)
)
l.append(o)
......
from string import zfill
destination_obj = context.getObject()
first_level_type = 'Use Case Scenario'
......
......@@ -2178,3 +2178,26 @@ class TestImage(ERP5TypeTestCase):
content_type,
(filename, image.getContentType(), content_type))
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):
# XXX: duplicate ActivityTool.tic, without locking as we are being
# multiple activity nodes in a single process.
for activity in ActivityTool.activity_dict.itervalues():
while not activity.dequeueMessage(activity_tool, node_id, ()):
while activity.dequeueMessage(activity_tool, node_id, ()):
pass
# Monkey-patch catalog to synchronise between main thread and the
# isolated transaction.
......
erp5_full_text_mroonga_catalog
erp5_base
erp5_csv_style
erp5_core_proxy_field_legacy
\ No newline at end of file
erp5_core_proxy_field_legacy
erp5_simulation_test
\ No newline at end of file
......@@ -19,6 +19,7 @@ test.erp5.testERP5Catalog
test.erp5.testERP5Category
test.erp5.testERP5Coordinate
test.erp5.testERP5Core
test.erp5.testERP5CoreSkins
test.erp5.testERP5Form
test.erp5.testERP5Type
test.erp5.testERP5TypeInterfaces
......
......@@ -29,7 +29,11 @@ if context.getPortalType() in ["Presentation"]:
portal = context.getPortalObject()
mimetype = 'text/html'
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:
raise ValueError("Failed to convert to %r" % mimetype)
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
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Utils import bytes2str
from erp5.component.interface.IWatermarkable import IWatermarkable
from erp5.component.document.Image import Image
from erp5.component.document.Document import ConversionError
from subprocess import Popen, PIPE
from zLOG import LOG, INFO, PROBLEM
import errno
from StringIO import StringIO
from io import BytesIO
from six.moves import range
import six
@zope.interface.implementer(IWatermarkable)
class PDFDocument(Image):
......@@ -90,8 +93,8 @@ class PDFDocument(Image):
raise ValueError("watermark_data cannot not be empty")
if not self.hasData():
raise ValueError("Cannot watermark an empty document")
self_reader = PdfFileReader(StringIO(self.getData()))
watermark_reader = PdfFileReader(StringIO(watermark_data))
self_reader = PdfFileReader(BytesIO(self.getData()))
watermark_reader = PdfFileReader(BytesIO(watermark_data))
watermark_page_count = watermark_reader.getNumPages()
output = PdfFileWriter()
......@@ -109,7 +112,7 @@ class PDFDocument(Image):
self_page.mergePage(watermark_page)
output.addPage(self_page)
outputStream = StringIO()
outputStream = BytesIO()
output.write(outputStream)
return outputStream.getvalue()
......@@ -171,7 +174,7 @@ class PDFDocument(Image):
"""
if not self.hasData():
return ''
data = str(self.getData())
data = bytes(self.getData())
try:
from PyPDF2 import PdfFileReader
from PyPDF2.utils import PdfReadError
......@@ -179,7 +182,7 @@ class PDFDocument(Image):
pass
else:
try:
if PdfFileReader(StringIO(data)).isEncrypted:
if PdfFileReader(BytesIO(data)).isEncrypted:
return ''
except PdfReadError:
return ''
......@@ -344,7 +347,7 @@ class PDFDocument(Image):
raise
result = {}
for line in command_result.splitlines():
for line in bytes2str(command_result).splitlines():
item_list = line.split(':')
key = item_list[0].strip()
value = ':'.join(item_list[1:]).strip()
......@@ -360,9 +363,9 @@ class PDFDocument(Image):
else:
try:
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("/")
if isinstance(info_value, unicode):
if six.PY2 and isinstance(info_value, six.text_type):
info_value = info_value.encode("utf-8")
# Ignore values that cannot be pickled ( such as AAPL:Keywords )
......
......@@ -49,6 +49,7 @@ Image | jump_to_wiki_predecessor
Image | local_permission
Image | related_document
Image | version_view
Notification Message | version_view
PDF | download
PDF | file_upload
PDF | jump_to_all_related
......
......@@ -41,6 +41,7 @@ from erp5.component.module.WorkingCopy import \
WorkingCopy, Dir, File, selfcached, \
NotAWorkingCopyError, NotVersionedError, VcsConflictError
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
# same working copy...
......
......@@ -41,6 +41,7 @@ from DateTime import DateTime
from ZTUtils import make_query
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
from Products.ERP5Type.Utils import simple_decorator
from six import string_types as basestring
@simple_decorator
def selfcached(func):
......
import json
from six import string_types as basestring
commit_dict = json.loads(commit_json) if commit_json is not None else {
'added': (),
......
......@@ -8,6 +8,7 @@ else:
print('<div style="color: black">')
# XXX: ERP5VCS_doCreateJavaScriptStatus should send lists
from six import string_types as basestring
if isinstance(added, basestring):
added = added != 'none' and filter(None, added.split(',')) or ()
if isinstance(modified, basestring):
......
......@@ -28,7 +28,6 @@
from AccessControl import ClassSecurityInfo
from DateTime import DateTime
from string import capitalize
from erp5.component.module.DateUtils import centis, getClosestDate, addToDate
from erp5.component.module.DateUtils import getDecimalNumberOfYearsBetween
......@@ -99,7 +98,7 @@ class AmortisationRule(RuleMixin):
modified_properties = []
for (key, value) in calculated_movement.items():
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)
previous_value = getter()
# Check if this property changes
......@@ -109,7 +108,7 @@ class AmortisationRule(RuleMixin):
if value is None and key.split('_')[-1] == 'value':
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(value)
simulation_movement.edit(start_date=simulation_movement.getStopDate())
......
......@@ -5,9 +5,6 @@
# This script adds the needed actions in the Immobilisation portal_type, and
# each amortisable portal_type
from string import capitalize
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=' ')
id = "%s_%s_amortisation_details_view" % (country, amortisation_method)
......@@ -22,8 +19,8 @@ def addAction(portal_type, portal_type_type, country, amortisation_method):
name = "Amortisation Details",
action = action,
condition = "object/IsUsing%s%sAmortisationMethod" % (
capitalize(country),
"".join([capitalize(x) for x in amortisation_method.split('_')]) ),
country.capitalize(),
"".join([x.capitalize() for x in amortisation_method.split('_')]) ),
permission = ('View',),
category = "object_view",
visible = 1)
......
from string import capitalize
view_id_basis = "%s_%s_amortisation_method_view_details"
view_action_basis = "Immobilisation_%s%sAmortisationMethodViewDetails"
view_condition_basis = "object/Immobilisation_isUsing%s%sAmortisationMethod"
......@@ -27,9 +25,9 @@ for method in amortisation_method_list:
exists = 1
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_condition = view_condition_basis % (capitalize(region),capitalized_id)
action_condition = view_condition_basis % (region.capitalize(), capitalized_id)
context.addAction(id = action_id,
name = "Amortisation Details",
action = action_action,
......
......@@ -252,14 +252,14 @@
<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());
orig_title string:Invoice;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: here.Base_translateString(orig_title);
orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8');
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8');
en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: here.Base_translateString(orig_page);
orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8');
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8');
en_of python: here.Base_translateString(orig_of, lang=default_language);
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_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'])">
......
......@@ -254,14 +254,14 @@
<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());
orig_title string:Invoice;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: here.Base_translateString(orig_title);
orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8');
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8');
en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: here.Base_translateString(orig_page);
orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8');
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8');
en_of python: here.Base_translateString(orig_of, lang=default_language);
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_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'])">
......
from six import string_types as basestring
toggable_pad = None
all_knowledge_pads = context.ERP5Site_getKnowledgePadListForUser(mode=mode)
if isinstance(knowledge_pad_url, basestring):
......
......@@ -249,14 +249,14 @@
<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());
orig_title string:Order;
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: here.Base_translateString(orig_title);
orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang=default_language), 'utf-8');
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8');
en_page python: here.Base_translateString(orig_page, lang=default_language);
my_page python: here.Base_translateString(orig_page);
orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang=default_language), 'utf-8');
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8');
en_of python: here.Base_translateString(orig_of, lang=default_language);
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_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']">
......
......@@ -245,14 +245,14 @@
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header tal:define="orig_title string:Packing List;
en_title python: unicode(here.Base_translateString(orig_title, lang='en'), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang='en');
my_title python: here.Base_translateString(orig_title);
orig_page string:Page;
en_page python: unicode(here.Base_translateString(orig_page, lang='en'), 'utf-8');
my_page python: unicode(here.Base_translateString(orig_page), 'utf-8');
en_page python: here.Base_translateString(orig_page, lang='en');
my_page python: here.Base_translateString(orig_page);
orig_of string:of;
en_of python: unicode(here.Base_translateString(orig_of, lang='en'), 'utf-8');
my_of python: unicode(here.Base_translateString(orig_of), 'utf-8');
en_of python: here.Base_translateString(orig_of, lang='en');
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_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']">
......
......@@ -361,7 +361,7 @@ class _ERP5AuthorisationEndpoint(AuthorizationEndpoint):
for key, value in six.iteritems(request_info_dict):
if value is None:
continue
if not isinstance(value, basestring):
if not isinstance(value, six.string_types):
raise TypeError((key, repr(value)))
new_request_info_dict[key] = value
inner_response = HTTPResponse(stdout=None, stderr=None)
......@@ -857,7 +857,7 @@ def _callEndpoint(endpoint, self, REQUEST):
request_body = urllib.urlencode([
(x, y)
for x, y in six.iteritems(REQUEST.form)
if isinstance(y, basestring)
if isinstance(y, six.string_types)
])
uri = other.get('URL', '')
query_string = environ.get('QUERY_STRING')
......
......@@ -9,11 +9,8 @@ def _getFacebookClientIdAndSecretKey(portal, reference="default"):
Internal function.
"""
result_list = unrestrictedSearchFacebookConnector(portal, reference=reference)
assert result_list, "Facebook Connector not found"
if len(result_list) == 2:
raise ValueError("Impossible to select one Facebook Connector")
facebook_connector = result_list[0]
facebook_connector = unrestrictedSearchFacebookConnector(portal, reference=reference)
assert facebook_connector, "Facebook Connector not found"
return facebook_connector.getClientId(), facebook_connector.getSecretKey()
def redirectToFacebookLoginPage(self, came_from=None):
......@@ -34,11 +31,18 @@ def getAccessTokenFromCode(self, code, redirect_uri):
app_id=client_id, app_secret=secret_key)
def unrestrictedSearchFacebookConnector(self, reference="default"):
return self.getPortalObject().portal_catalog.unrestrictedSearchResults(
result_list = self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type="Facebook Connector",
reference=reference,
validation_state="validated",
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):
if REQUEST is not None:
......
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getFacebookConnector</string> </value>
<value> <string>ERP5Site_getDefaultFacebookConnector</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -4,6 +4,9 @@ result_list = portal.portal_catalog(
reference=reference,
validation_state="validated",
limit=2)
if not result_list:
return
if len(result_list) != 1:
raise ValueError("Impossible to select one Google Connector")
return result_list[0].getObject()
......@@ -60,13 +60,16 @@ class GoogleLoginTestCase(ERP5TypeTestCase):
).validate()
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(
id=self.dummy_connector_id,
portal_type="Google Connector",
reference="default",
client_id=self.client_id,
secret_key=self.secret_key)
if connector.getValidationState() != "validated":
connector.validate()
self.tic()
......@@ -416,6 +419,22 @@ class TestERP5JSGoogleLogin(GoogleLoginTestCase):
self.assertEqual(resp.getStatus(), six.moves.http_client.FOUND)
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):
resp = self.publish(self._getWebSite().getPath() + '/WebSite_logout')
self.assertEqual(resp.getCookie("__ac_google_hash")['value'], 'deleted')
......@@ -72,7 +72,6 @@
serie.drawPoints = true;
serie.strokeWidth = 0;
}
console.log("serie", serie);
graph_data_and_parameter.series[trace.title || ''] = serie;
}
for (i = 0; i < data.length; i = i + 1) {
......@@ -195,7 +194,11 @@
graph_data_and_parameter;
container = gadget.element.querySelector(".graph-content");
graph_data_and_parameter = formatGraphDict(modification_dict.value);
if (modification_dict.value.new_format) {
graph_data_and_parameter = formatGraphDict(modification_dict.value);
} else {
graph_data_and_parameter = getGraphDataAndParameterFromConfiguration(modification_dict.value);
}
gadget.property_dict.graph = new Dygraph(container,
graph_data_and_parameter.dygraph_data,
graph_data_and_parameter.dygraph_parameter_dict);
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.32471.45294.12919</string> </value>
<value> <string>1016.58116.20617.24900</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1715371703.99</float>
<float>1716991783.66</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -60,12 +60,12 @@ if not zip_file:
rejectSoftwarePublication(software_publication)
return
from cStringIO import StringIO
from io import BytesIO
import zipfile
from zipfile import BadZipfile
zipbuffer = StringIO()
zipbuffer.write(str(zip_file.getData()))
zipbuffer = BytesIO()
zipbuffer.write(bytes(zip_file.getData()))
try:
zip_reader = zipfile.ZipFile(zipbuffer)
except BadZipfile:
......
......@@ -3,6 +3,29 @@
(function (window, rJS) {
"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)
/////////////////////////////////////////////////////////////////
// Acquired methods
......@@ -41,40 +64,22 @@
})
.push(function (hateoas_url) {
gadget.hateoas_url = hateoas_url;
}).push(function () {
gadget.updateResourceListField();
// Do it synchronously, to ensure the full form
// will be displayed only when the select field has the expected
// values
return updateResourceListField(gadget);
});
})
.declareMethod('triggerSubmit', function () {
return this.form.triggerSubmit();
})
.declareJob('updateResourceListField', function () {
var gadget = 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;
}
});
.declareJob('deferUpdateResourceListField', function () {
return updateResourceListField(this);
})
.onEvent('change', function (evt) {
var gadget = this;
if (evt.target.id === "field_your_project") {
gadget.updateResourceListField();
gadget.deferUpdateResourceListField();
}
}, false, false);
}(window, rJS));
\ No newline at end of file
......@@ -69,7 +69,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -244,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.26853.29747.36369</string> </value>
<value> <string>1017.45366.38938.62225</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,8 +266,8 @@
</tuple>
<state>
<tuple>
<float>1607511772.32</float>
<string>GMT+1</string>
<float>1719991591.9</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
......@@ -14,7 +14,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>zzz_logout_test</string> </value>
<value> <string>officejs_support_request_ui_logout_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -14,7 +14,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>translation_zuite</string> </value>
<value> <string>officejs_support_request_ui_translation_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -71,6 +71,11 @@
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text()="FeatureRequire"]</td>
......
......@@ -34,8 +34,23 @@
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>FeatureRequire</td>
<td>waitForElementNotPresent</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>
</tr>
<tr>
......
......@@ -39,6 +39,11 @@
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>FeatureRequire</td>
......
......@@ -33,6 +33,11 @@
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>FeatureRequire</td>
......
......@@ -14,6 +14,7 @@
<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" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
......@@ -14,6 +14,7 @@
<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" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</td>
......@@ -36,6 +37,7 @@
<td>10000</td>
<td></td>
</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" />
</tbody></table>
</body>
......
......@@ -33,6 +33,11 @@
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>BugReport</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>FeatureRequire</td>
......
......@@ -14,6 +14,7 @@
<tr><td>open</td>
<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 -->
<tr><td>waitForElementPresent</td>
......
......@@ -14,6 +14,7 @@
<tr><td>open</td>
<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 -->
<tr><td>waitForElementPresent</td>
......
......@@ -14,6 +14,7 @@
<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" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
......@@ -14,6 +14,7 @@
<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" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
......
......@@ -28,35 +28,29 @@
<tr><td>type</td>
<td>//input[@name='field_your_title']</td>
<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>
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//option[@text="BugReport"]</td>
<td>//option[text()="BugReport"]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//option[@text="BugReport"]</td>
<td>//option[text()="BugReport"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//option[@text="FeatureRequire"]</td>
<td>//option[text()="FeatureRequire"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//option[@text="FeatureRequire"]</td>
<td>//option[text()="FeatureRequire"]</td>
<td></td>
</tr>
<tr><td>select</td>
<td>field_your_resource</td>
......
......@@ -14,6 +14,7 @@
<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" />
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(@class, "ui-icon-life-ring") and text() = "Support Requests"]</td>
......@@ -45,6 +46,8 @@
<td></td>
</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_listbox_loaded" />
<tr>
<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>
......@@ -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></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</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
portal_categories/use/crm
portal_categories/use/crm/event
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/**
project_module/erp5_officejs_support_request_ui_test_project_001
......
test.erp5.testFunctionalSupportRequest
test.erp5.testFunctionalSupportRequestLogout
test.erp5.testFunctionalSupportRequestTranslation
test.erp5.testSupportRequest
\ No newline at end of file
from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject()
num = 0
......@@ -20,8 +19,8 @@ for [method_id, result] in result_list:
int_len = 7
if not result['success']:
o = newTempBase(portal_object, safe_id)
o.setUid( 'new_%s' % zfill(num, 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.setUid( 'new_%s' % str(num).zfill(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'])
result_listbox.append(o)
......
from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject()
num = 0
......@@ -25,8 +24,8 @@ for [method_id, result] in result_list:
num += 1
int_len = 3
o = newTempBase(portal_object, safe_id)
o.setUid( 'new_%s' % zfill(num, 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.setUid( 'new_%s' % str(num).zfill(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
, result = result['message']
, object_url = result['object_url']
......
from Products.ERP5Type.Document import newTempBase
from string import zfill
num = 0
listbox_lines = []
......@@ -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 = 7
o = newTempBase(context, safe_id)
o.setUid('new_%s' % zfill(num, 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.setUid('new_%s' % str(num).zfill(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(
id=safe_id,
spreadsheet_name=spreadsheet,
......
......@@ -262,15 +262,15 @@
<tal:block define="
date_renderer nocall:here/Base_viewFieldLibrary/my_date/render_pdf;
orig_title python: 'Payslip';
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: here.Base_translateString(orig_title);
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()),
'stop_date': date_renderer(pay_sheet_transaction.getStopDate())}), 'utf-8');
my_period python: unicode(here.Base_translateString(orig_period,
'stop_date': date_renderer(pay_sheet_transaction.getStopDate())});
my_period python: here.Base_translateString(orig_period,
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_width python: data_dict['destination_section_image_width'];
image_height python: data_dict['destination_section_image_height']">
......@@ -404,27 +404,27 @@
<table:covered-table-cell/>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell>
......@@ -631,7 +631,7 @@
<table:table-cell table:style-name='Tableau3.A1' office:value-type='string'>
<text:p text:style-name='Table_20_Contents'/>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p>
</table:table-cell>
......
......@@ -329,27 +329,27 @@
<table:covered-table-cell/>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell>
......@@ -556,7 +556,7 @@
<table:table-cell table:style-name='Tableau3.A1' office:value-type='string'>
<text:p text:style-name='Table_20_Contents'/>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/>:</text:p>
</table:table-cell>
......
......@@ -260,15 +260,15 @@
<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;
orig_title python: 'Payslip';
en_title python: unicode(here.Base_translateString(orig_title, lang=default_language), 'utf-8');
my_title python: unicode(here.Base_translateString(orig_title), 'utf-8');
en_title python: here.Base_translateString(orig_title, lang=default_language);
my_title python: here.Base_translateString(orig_title);
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()),
'stop_date': date_renderer(here.getStopDate())}), 'utf-8');
my_period python: unicode(here.Base_translateString(orig_period,
'stop_date': date_renderer(here.getStopDate())});
my_period python: here.Base_translateString(orig_period,
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_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']">
......
......@@ -30,7 +30,7 @@ macro is found. It's used to display description field -->
xmlns:metal='http://xml.zope.org/namespaces/metal'>
<tal:block metal:define-macro="other_informations">
<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'/>
<span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p>
</table:table-cell>
......
......@@ -27,9 +27,9 @@
xmlns:metal='http://xml.zope.org/namespaces/metal'>
<tal:block metal:define-macro="other_informations"
tal:define="data_dict here/PaySheetTransaction_getOtherInformationsDataDict;
quantity_renderer nocall:here/Base_viewFieldLibrary/my_view_mode_money_quantity/render_pdf;
default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
hour_renderer nocall:here/AnnotationLine_viewFieldLibrary/my_work_time_annotation_line_quantity/render_pdf;">
quantity_renderer nocall:here/Base_viewFieldLibrary/my_view_mode_money_quantity/render_pdf;
default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
hour_renderer nocall:here/AnnotationLine_viewFieldLibrary/my_work_time_annotation_line_quantity/render_pdf;">
<table:table-row table:style-name='Tableau3.8'>
<table:table-cell table:style-name='Tableau3.A8' office:value-type='string'>
<text:p text:style-name='Table_20_Contents' />
......@@ -142,27 +142,27 @@
<table:covered-table-cell/>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</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' tal:condition='python:translated_message != orig_message'><span tal:replace='translated_message'/></text:p>
</table:table-cell>
......@@ -266,7 +266,7 @@
<table:covered-table-cell/>
</table:table-row>
<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'/>
<span tal:omit-tag='' tal:condition='python:translated_message != orig_message'> / <span tal:replace='translated_message'/></span>:</text:p>
</table:table-cell>
......
......@@ -11,8 +11,8 @@ for item in item_list:
item_value = item[int(not is_right_display)]
# Hash key from item_value
item_split = string.split(item_value, '/')
item_key = string.join(item_split[:split_depth] , '/' )
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0]
if item_key not in sub_field_dict:
# Create property dict
......
......@@ -11,8 +11,8 @@ for item in item_list:
item_value = item[int(not is_right_display)]
# Hash key from item_value
item_split = string.split(item_value, '/')
item_key = string.join(item_split[:split_depth] , '/' )
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
if item_key not in sub_field_dict:
# Create property dict
......
from Products.ERP5Type.Document import newTempBase
from string import zfill
portal_object = context.getPortalObject()
......@@ -15,7 +14,7 @@ def createInputLine(new_id):
int_len = 3
o = newTempBase( portal_object,
str(new_id),
uid ='new_%s' % zfill(new_id, int_len)
uid ='new_%s' % str(new_id).zfill(int_len)
)
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