diff --git a/.gitignore b/.gitignore index aefc9c7d..c0c55cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ lib lib64 include local +share src/appy src/collective.excelexport diff --git a/.travis.yml b/.travis.yml index 0e9db67b..bfde054f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +dist: xenial + language: python python: @@ -14,33 +16,48 @@ env: - PLONE_VERSION=5.0 - PLONE_VERSION=5.1 +services: + - docker + before_install: - pip install --upgrade pip + - docker pull xcgd/libreoffice:5.1 + - docker pull xcgd/libreoffice:latest install: - - sudo apt-get -qq install libfreetype6-dev liblcms1-dev libreoffice + - sudo apt update -qq -y + - sudo apt install -qq -y libfreetype6-dev liblcms2-dev make libreoffice libreoffice-script-provider-python + - sudo apt autoremove -qq -y + - sudo apt autoclean -qq -y - mkdir -p buildout-cache/{eggs,downloads} - mkdir $HOME/tmp - chmod 777 $HOME/tmp - export TMPDIR=$HOME/tmp - - sed -ie "s#plone-5#plone-$PLONE_VERSION#" buildout.cfg - sed -ie "s#travis-5#travis-$PLONE_VERSION#" travis.cfg - pip install lxml --no-binary lxml - - python --version - - python bootstrap.py --version=2.10.0 + - python -V + - pip install -r requirements.txt + - python bootstrap.py --version=2.11.4 - bin/buildout -N -c travis.cfg annotate - - bin/buildout -N -c travis.cfg - - bin/translation-manage -c + - bin/buildout -Nt 5 -c travis.cfg before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start + - docker run -p 127.0.0.1:2002:8997 -d --rm --name="oo_server" xcgd/libreoffice:5.1 + - bin/translation-manage -c script: + - docker ps + - bin/test + - docker stop oo_server + - docker run -p 127.0.0.1:2002:8997 -d --rm --name="oo_server" xcgd/libreoffice:latest + - docker ps + - bin/test + - docker stop oo_server + - /usr/bin/soffice --invisible --headless --nologo --nofirststartwizard --accept="socket,host=localhost,port=2002;urp" & > /dev/null 2>&1 - bin/test after_success: - - bin/createcoverage + - bin/createcoverage -d htmlcov - pip install --upgrade pip - pip install -q coveralls==0.5 - coveralls diff --git a/CHANGES.rst b/CHANGES.rst index 539afbfe..7da62334 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,6 +20,8 @@ Changelog [gbastien] - Moved files CHANGES.rst, README.rst and CONTRIBUTORS.rst from docs/ to root. [gbastien] +- Added ability to use an external server process for LibreOffice. + [odelaere] 3.6 (2019-03-27) ---------------- diff --git a/Makefile b/Makefile index 786139d7..34e323cf 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ #!/usr/bin/make # +lo_version=latest + all: run -.PHONY: bootstrap buildout run test cleanall +.PHONY: bootstrap buildout run test cleanall startlibreoffice stoplibreoffice bootstrap: virtualenv-2.7 . pip install -r requirements.txt @@ -19,9 +21,18 @@ run: test: if ! test -f bin/test;then make buildout;fi + make startlibreoffice rm -fr htmlcov bin/translation-manage -c bin/test + make stoplibreoffice cleanall: - rm -fr develop-eggs htmlcov include .installed.cfg lib .mr.developer.cfg parts downloads eggs + rm -fr bin develop-eggs htmlcov include .installed.cfg lib .mr.developer.cfg parts downloads eggs + +startlibreoffice: + make stoplibreoffice + docker run -p 2002:8997 -d --rm --name="oo_server" xcgd/libreoffice:$(lo_version) + +stoplibreoffice: + if docker ps | grep oo_server;then docker stop oo_server;fi \ No newline at end of file diff --git a/bin/soffice.sh b/bin/soffice.sh deleted file mode 100755 index a45bb6f8..00000000 --- a/bin/soffice.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# libreoffice.org headless server script -# -# $1 : 'start', 'stop', 'restart' - -LO_HOME=/usr/bin -SOFFICE_PATH=$LO_HOME/soffice -set -e - -ScriptLocation="." -if [[ $0 == '/'* ]]; -then - ScriptLocation="`dirname $0`" -else - ScriptLocation="`pwd`"/"`dirname $0`" -fi - -PIDFILE=$ScriptLocation/soffice-server.pid - -function get_pid() -{ - echo `ps ax|grep 'soffice.bin'|grep 'port=2002'|xargs|cut -d\ -f1` -} - -function do_start() -{ - if [ -f $PIDFILE ]; then - echo "LibreOffice headless server has already started." - exit - fi - if lsof -i tcp:2002 >/dev/null; then - echo "A process is already using the 2002 port." - exit - fi - echo "Starting LibreOffice headless server..." - $SOFFICE_PATH --invisible --headless --nologo --nofirststartwizard --accept="socket,host=localhost,port=2002;urp" & > /dev/null 2>&1 - PID=$(get_pid) - COUNTER=0 - while [ "$PID" = "" -a "$COUNTER" -lt 20 ]; do - sleep 1 - COUNTER=$((COUNTER + 1)) - PID=$(get_pid) - done - echo $PID> $PIDFILE - echo `cat $PIDFILE` -} - -function do_stop() -{ - if [ -f $PIDFILE ]; then - PID=`cat $PIDFILE` - if [ -n "$PID" ] && ps -p "$PID" > /dev/null; then - echo "Stopping LibreOffice headless server..." - kill $PID - fi - rm -f $PIDFILE - else - echo "LibreOffice headless server is not running !" - fi -} - -case "$1" in - start) - do_start - ;; - stop) - do_stop - ;; - restart) - do_stop - do_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 -esac diff --git a/setup.py b/setup.py index 62257437..64f0c46e 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,8 @@ 'z3c.table', # fix about orderedselect 'z3c.form>=3.2.4', - 'imio.helpers>=0.13', + 'imio.helpers>=0.18', + 'imio.migrator>=1.11' ], extras_require={ 'test': [ diff --git a/src/collective/documentgenerator/browser/controlpanel.py b/src/collective/documentgenerator/browser/controlpanel.py index 6541b452..7ca90ea2 100644 --- a/src/collective/documentgenerator/browser/controlpanel.py +++ b/src/collective/documentgenerator/browser/controlpanel.py @@ -41,6 +41,13 @@ class IDocumentGeneratorControlPanelSchema(Interface): """ """ + oo_server = schema.TextLine( + title=_(u'oo_server'), + description=_(u'IP address or hostname of OO.'), + required=False, + default=safe_unicode(os.getenv('OO_SERVER', u'localhost')), + ) + oo_port = schema.Int( title=_(u'oo_port'), description=_(u'Port Number of OO.'), @@ -52,7 +59,7 @@ class IDocumentGeneratorControlPanelSchema(Interface): title=_(u'uno path'), description=_(u'Path of python with uno.'), required=False, - default=safe_unicode(os.getenv('PYTHON_UNO', u'/usr/bin/python')), + default=safe_unicode(os.getenv('PYTHON_UNO', u'/usr/bin/python3')), constraint=check_for_uno ) @@ -75,6 +82,14 @@ class IDocumentGeneratorControlPanelSchema(Interface): default=False ) + use_stream = schema.Bool( + title=_(u'Force communication via in/out stream with LibreOffice.'), + description=_(u'If enabled, this will force using stream to communicate witth LibreOffice server. ' + u'This must be true if the LO server is not on localhost or is in a docker container.'), + required=True, + default=True + ) + class DocumentGeneratorControlPanelEditForm(RegistryEditForm): implements(IDocumentGeneratorSettings) diff --git a/src/collective/documentgenerator/browser/generation_view.py b/src/collective/documentgenerator/browser/generation_view.py index c68d3326..998b8c2d 100644 --- a/src/collective/documentgenerator/browser/generation_view.py +++ b/src/collective/documentgenerator/browser/generation_view.py @@ -227,11 +227,39 @@ def _render_document(self, pod_template, output_format, sub_documents, raiseOnEr if 'Manager' in api.user.get_roles() and output_format == 'odt': raiseOnError = False + # stylesMapping.update({'para[class=None, parent != cell]': 'texte_delibe', + # 'para[class=xSmallText, parent != cell]': 'bodyXSmall', + # 'para[class=smallText, parent != cell]': 'bodySmall', + # 'para[class=largeText, parent != cell]': 'bodyLarge', + # 'para[class=xLargeText, parent != cell]': 'bodyXLarge', + # 'para[class=indentation, parent != cell]': 'bodyIndentation', + # 'para[class=None, parent = cell]': 'cell_delibe', + # 'table': TableProperties(cellContentStyle='cell_delibe'), + # 'para[class=xSmallText, parent = cell]': 'cellXSmall', + # 'para[class=smallText, parent = cell]': 'cellSmall', + # 'para[class=largeText, parent = cell]': 'cellLarge', + # 'para[class=xLargeText, parent = cell]': 'cellXLarge', + # 'para[class=indentation, parent = cell]': 'cellIndentation', + # }) + # stylesMapping.update({'para[class=None,parent!=cell]': 'texte_delibe', + # 'para[class=xSmallText,parent!=cell]': 'bodyXSmall', + # 'para[class=smallText,parent!=cell]': 'bodySmall', + # 'para[class=largeText,parent!=cell]': 'bodyLarge', + # 'para[class=xLargeText,parent!=cell]': 'bodyXLarge', + # 'para[class=indentation,parent!=cell]': 'bodyIndentation', + # 'para[class=xSmallText,parent=cell]': 'cellXSmall', + # 'para[class=smallText,parent=cell]': 'cellSmall', + # 'para[class=largeText,parent=cell]': 'cellLarge', + # 'para[class=xLargeText,parent=cell]': 'cellXLarge', + # 'para[class=indentation,parent=cell]': 'cellIndentation', + # }) + renderer = Renderer( StringIO(document_template.data), generation_context, temp_filename, pythonWithUnoPath=config.get_uno_path(), + ooServer=config.get_oo_server(), ooPort=config.get_oo_port(), raiseOnError=raiseOnError, imageResolver=api.portal.get(), @@ -239,6 +267,7 @@ def _render_document(self, pod_template, output_format, sub_documents, raiseOnEr optimalColumnWidths=optimalColumnWidths, distributeColumns=distributeColumns, stylesMapping=stylesMapping, + stream=config.get_use_stream(), **kwargs ) @@ -449,7 +478,7 @@ def _get_base_args(self, template_uid, output_format): if (not base_hasattr(self.orig_template, 'mailing_loop_template') or not self.orig_template.mailing_loop_template): raise Exception("Cannot find 'mailing_loop_template' on template '{0}'".format( - self.orig_template.absolute_url())) + self.orig_template.absolute_url())) loop_template = self.get_pod_template(self.orig_template.mailing_loop_template) if 'output_format' not in annot: diff --git a/src/collective/documentgenerator/config.py b/src/collective/documentgenerator/config.py index b49c4fa6..57063569 100644 --- a/src/collective/documentgenerator/config.py +++ b/src/collective/documentgenerator/config.py @@ -5,7 +5,6 @@ import os - ODS_FORMATS = (('ods', 'LibreOffice Calc (.ods)'), ('xls', 'Microsoft Excel (.xls)'),) @@ -31,6 +30,12 @@ def get_uno_path(): ) +def get_oo_server(): + return api.portal.get_registry_record( + 'collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.oo_server' + ) + + def get_oo_port(): return api.portal.get_registry_record( 'collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.oo_port' @@ -50,6 +55,22 @@ def get_raiseOnError_for_non_managers(): ) +def get_use_stream(): + use_stream = api.portal.get_registry_record( + 'collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.use_stream' + ) + # backward compat. Default value is auto + return use_stream or 'auto' + + +def set_oo_server(): + """ Get environment value in buildout to define port """ + oo_server = os.getenv('OO_SERVER', None) + if oo_server: + api.portal.set_registry_record('collective.documentgenerator.browser.controlpanel.' + 'IDocumentGeneratorControlPanelSchema.oo_server', oo_server) + + def set_oo_port(): """ Get environment value in buildout to define port """ oo_port = os.getenv('OO_PORT', None) @@ -78,3 +99,10 @@ def set_raiseOnError_for_non_managers(value): 'collective.documentgenerator.browser.controlpanel.' 'IDocumentGeneratorControlPanelSchema.raiseOnError_for_non_managers', value) + + +def set_use_stream(value): + api.portal.set_registry_record( + 'collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.use_stream', + value + ) diff --git a/src/collective/documentgenerator/events/styles_events.py b/src/collective/documentgenerator/events/styles_events.py index f3658bd6..3c02e9aa 100644 --- a/src/collective/documentgenerator/events/styles_events.py +++ b/src/collective/documentgenerator/events/styles_events.py @@ -1,5 +1,11 @@ # -*- coding: utf-8 -*- +import logging +import os +import tempfile + +import appy.pod +from Products.CMFPlone.utils import safe_unicode from appy.shared.utils import executeCommand from collective.documentgenerator import _ from collective.documentgenerator import config @@ -7,14 +13,8 @@ from collective.documentgenerator.utils import remove_tmp_file from plone import api from plone.namedfile.file import NamedBlobFile -from Products.CMFPlone.utils import safe_unicode from zExceptions import Redirect - -import appy.pod -import logging -import os -import tempfile - +from zope.i18n import translate logger = logging.getLogger('collective.documentgenerator: styles update') @@ -34,7 +34,7 @@ def update_styles_of_all_PODtemplate(style_template, event): for brain in pod_templates: pod_template = brain.getObject() if pod_template.has_linked_template() or \ - pod_template.odt_file.contentType != 'application/vnd.oasis.opendocument.text': + pod_template.odt_file.contentType != 'application/vnd.oasis.opendocument.text': continue if pod_template.get_style_template() == style_template: _update_template_styles(pod_template, style_template_file.name) @@ -71,8 +71,8 @@ def _update_template_styles(pod_template, style_template_filename): Update template pod_template by templateStyle. """ # we check if the pod_template has been modified except by style only - style_changes_only = pod_template.style_modification_md5 and \ - pod_template.current_md5 == pod_template.style_modification_md5 + style_changes_only = pod_template.style_modification_md5 and\ + pod_template.current_md5 == pod_template.style_modification_md5 # save in temporary file, the template temp_file = create_temporary_file(pod_template.odt_file, 'pod_template.odt') new_template = open(temp_file.name, 'w') @@ -80,13 +80,16 @@ def _update_template_styles(pod_template, style_template_filename): new_template.close() # merge style from templateStyle in template - cmd = '{path} {script} {tmp_file} {extension} -p{port} -t{style_template}'.format( + cmd = '{path} {script} {tmp_file} {extension} -e ' \ + '{libreoffice_host} -p {port} -t {style_template} -v -a {stream}'.format( path=config.get_uno_path(), script=CONVSCRIPT, tmp_file=temp_file.name, extension='odt', + libreoffice_host=config.get_oo_server(), port=config.get_oo_port(), - style_template=style_template_filename + style_template=style_template_filename, + stream=config.get_use_stream(), ) (stdout, stderr) = executeCommand(cmd.split()) if stderr: @@ -96,14 +99,15 @@ def _update_template_styles(pod_template, style_template_filename): request = portal.REQUEST try: api.portal.show_message(message=_(u"Problem during styles update on template '${tmpl}': ${err}", - mapping={'tmpl': safe_unicode(pod_template.absolute_url_path()), - 'err': safe_unicode(stderr)}), + mapping={'tmpl': safe_unicode(pod_template.absolute_url_path()), + 'err': safe_unicode(stderr)}), request=request, type='error') except: pass - raise Redirect(request.get('ACTUAL_URL'), _(u"Problem during styles update on template '${tmpl}': ${err}", - mapping={'tmpl': safe_unicode(pod_template.absolute_url_path()), - 'err': safe_unicode(stderr)})) + raise Redirect(request.get('ACTUAL_URL'), + translate(_(u"Problem during styles update on template '${tmpl}': ${err}", + mapping={'tmpl': safe_unicode(pod_template.absolute_url_path()), + 'err': safe_unicode(stderr)}))) # read the merged file resTempFileName = '.res.'.join(temp_file.name.rsplit('.', 1)) diff --git a/src/collective/documentgenerator/locales/collective.documentgenerator.pot b/src/collective/documentgenerator/locales/collective.documentgenerator.pot index 0c171e0f..48226f36 100644 --- a/src/collective/documentgenerator/locales/collective.documentgenerator.pot +++ b/src/collective/documentgenerator/locales/collective.documentgenerator.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2018-04-23 07:59+0000\n" +"POT-Creation-Date: 2019-05-08 15:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,11 +14,11 @@ msgstr "" "Preferred-Encodings: utf-8 latin1\n" "Domain: DOMAIN\n" -#: ../browser/controlpanel.py:83 +#: ../browser/controlpanel.py:99 msgid "" msgstr "" -#: ../utils.py:79 +#: ../utils.py:77 msgid "${error_message} for key = '${key}'" msgstr "" @@ -30,15 +30,15 @@ msgstr "" msgid "A document to generate on a content." msgstr "" -#: ../browser/table.py:218 +#: ../browser/table.py:221 msgid "Actions" msgstr "" -#: ../content/pod_template.py:269 +#: ../content/pod_template.py:272 msgid "Allowed portal types" msgstr "" -#: ../content/pod_template.py:260 +#: ../content/pod_template.py:263 msgid "Available formats" msgstr "" @@ -54,27 +54,27 @@ msgstr "" msgid "Can't import python uno library with the python path" msgstr "" -#: ../browser/controlpanel.py:96 +#: ../browser/controlpanel.py:112 msgid "Cancel" msgstr "" -#: ../browser/controlpanel.py:93 +#: ../browser/controlpanel.py:109 msgid "Changes saved" msgstr "" -#: ../content/pod_template.py:245 +#: ../content/pod_template.py:248 msgid "Check if this POD Template can be reused by other POD Template" msgstr "" -#: ../content/pod_template.py:299 +#: ../content/pod_template.py:302 msgid "Choose the mailing loop template to apply for this template." msgstr "" -#: ../content/pod_template.py:72 +#: ../content/pod_template.py:75 msgid "Choose the style template to apply for this template." msgstr "" -#: ../setuphandlers.py:162 +#: ../setuphandlers.py:165 msgid "Collection template" msgstr "" @@ -82,101 +82,109 @@ msgstr "" msgid "ConfigurablePODTemplate" msgstr "" -#: ../content/pod_template.py:288 +#: ../content/pod_template.py:291 msgid "Context variables." msgstr "" -#: ../utils.py:76 +#: ../utils.py:74 msgid "Dict update collision on key" msgstr "" -#: ../browser/table.py:152 -#: ../content/vocabulary.py:93 +#: ../browser/table.py:155 +#: ../content/vocabulary.py:102 msgid "Disabled" msgstr "" -#: ../content/vocabulary.py:96 +#: ../content/vocabulary.py:105 msgid "Distribute" msgstr "" -#: ../content/pod_template.py:179 +#: ../content/pod_template.py:182 msgid "Do rendering" msgstr "" -#: ../browser/controlpanel.py:82 +#: ../browser/controlpanel.py:98 #: ../profiles/base/controlpanel.xml msgid "Document Generator settings" msgstr "" -#: ../browser/controlpanel.py:98 +#: ../browser/controlpanel.py:114 msgid "Edit cancelled" msgstr "" -#: ../browser/table.py:140 -#: ../content/pod_template.py:64 +#: ../browser/table.py:143 +#: ../content/pod_template.py:67 msgid "Enabled" msgstr "" -#: ../browser/generation_view.py:250 +#: ../browser/generation_view.py:297 msgid "Error when merging context_variables in generation context" msgstr "" -#: ../browser/generation_view.py:248 +#: ../browser/generation_view.py:295 msgid "Error when merging helper_view in generation context" msgstr "" -#: ../browser/generation_view.py:255 +#: ../browser/generation_view.py:437 msgid "Error when merging mailed_data in generation context" msgstr "" -#: ../browser/generation_view.py:426 +#: ../browser/generation_view.py:502 msgid "Error when merging mailing_list in generation context" msgstr "" -#: ../browser/generation_view.py:184 +#: ../browser/generation_view.py:202 msgid "Error when merging merge_templates in generation context" msgstr "" -#: ../tests/test_generation_view.py:256 -msgid "Failing template" +#: ../browser/controlpanel.py:86 +msgid "Force communication via in/out stream with LibreOffice." msgstr "" -#: ../content/vocabulary.py:118 +#: ../content/vocabulary.py:127 msgid "Force disabled" msgstr "" -#: ../content/vocabulary.py:121 +#: ../content/vocabulary.py:130 msgid "Force distribute" msgstr "" -#: ../content/vocabulary.py:119 +#: ../content/vocabulary.py:128 msgid "Force nothing" msgstr "" -#: ../content/vocabulary.py:120 +#: ../content/vocabulary.py:129 msgid "Force optimize" msgstr "" -#: ../setuphandlers.py:124 +#: ../setuphandlers.py:127 msgid "General template" msgstr "" -#: ../content/vocabulary.py:113 +#: ../content/vocabulary.py:122 msgid "Global value (${global_value})" msgstr "" -#: ../setuphandlers.py:92 +#: ../setuphandlers.py:95 msgid "Header" msgstr "" -#: ../browser/controlpanel.py:18 +#: ../browser/controlpanel.py:46 +msgid "IP address or hostname of OO." +msgstr "" + +#: ../browser/controlpanel.py:19 msgid "If enabled, this will allow the \"table-layout: fixed|auto|none\" CSS style handling while generating document. If no such style is defined on the table, the chosen column modifier of LibreOffice will be applied." msgstr "" -#: ../browser/controlpanel.py:68 +#: ../browser/controlpanel.py:76 msgid "If enabled, this will avoid generating a document containing an error, instead a common Plone error will be raised. Nevertheless to ease debugging, Managers will continue to get errors in the generated document if it uses .odt format." msgstr "" +#: ../browser/controlpanel.py:87 +msgid "If enabled, this will force using stream to communicate witth LibreOffice server. This must be true if the LO server is not on localhost or is in a docker container." +msgstr "" + #: ../profiles.zcml:15 msgid "Installs the collective.documentgenerator add-on." msgstr "" @@ -197,8 +205,8 @@ msgstr "" msgid "Linked POD Template using this one" msgstr "" -#: ../content/pod_template.py:298 -#: ../setuphandlers.py:108 +#: ../content/pod_template.py:301 +#: ../setuphandlers.py:111 msgid "Mailing loop template" msgstr "" @@ -206,15 +214,15 @@ msgstr "" msgid "MailingLoopTemplate" msgstr "" -#: ../browser/table.py:169 +#: ../browser/table.py:172 msgid "Modified" msgstr "" -#: ../setuphandlers.py:138 +#: ../setuphandlers.py:141 msgid "Multiple format template" msgstr "" -#: ../content/pod_template.py:215 +#: ../content/pod_template.py:218 msgid "No format selected" msgstr "" @@ -222,28 +230,28 @@ msgstr "" msgid "None" msgstr "" -#: ../content/vocabulary.py:94 +#: ../content/vocabulary.py:103 msgid "Nothing" msgstr "" -#: ../content/pod_template.py:52 -#: ../content/style_template.py:29 +#: ../content/pod_template.py:55 +#: ../content/style_template.py:28 msgid "ODT File" msgstr "" -#: ../content/vocabulary.py:95 +#: ../content/vocabulary.py:104 msgid "Optimize" msgstr "" -#: ../browser/table.py:162 +#: ../browser/table.py:165 msgid "Original" msgstr "" -#: ../setuphandlers.py:41 +#: ../setuphandlers.py:44 msgid "POD Templates" msgstr "" -#: ../content/pod_template.py:173 +#: ../content/pod_template.py:176 msgid "POD context name" msgstr "" @@ -251,63 +259,63 @@ msgstr "" msgid "PODTemplate" msgstr "" -#: ../browser/table.py:104 +#: ../browser/table.py:107 msgid "Path" msgstr "" -#: ../browser/controlpanel.py:52 +#: ../browser/controlpanel.py:60 msgid "Path of python with uno." msgstr "" -#: ../browser/table.py:182 +#: ../browser/table.py:185 msgid "Pod formats" msgstr "" -#: ../browser/controlpanel.py:45 +#: ../browser/controlpanel.py:53 msgid "Port Number of OO." msgstr "" -#: ../setuphandlers.py:209 +#: ../setuphandlers.py:212 msgid "Possibly mailed template" msgstr "" -#: ../events/styles_events.py:96 +#: ../events/styles_events.py:98 msgid "Problem during styles update on template '${tmpl}': ${err}" msgstr "" -#: ../browser/controlpanel.py:67 +#: ../browser/controlpanel.py:75 msgid "Raise an error instead generating the document" msgstr "" -#: ../content/pod_template.py:244 +#: ../content/pod_template.py:247 msgid "Reusable" msgstr "" -#: ../setuphandlers.py:226 +#: ../setuphandlers.py:235 msgid "Reusable template" msgstr "" -#: ../setuphandlers.py:245 +#: ../setuphandlers.py:254 msgid "Reuse Test Template" msgstr "" -#: ../browser/controlpanel.py:85 +#: ../browser/controlpanel.py:101 msgid "Save" msgstr "" -#: ../content/pod_template.py:252 +#: ../content/pod_template.py:255 msgid "Select Existing POD Template to reuse" msgstr "" -#: ../content/pod_template.py:270 +#: ../content/pod_template.py:273 msgid "Select for which content types the template will be available." msgstr "" -#: ../content/pod_template.py:261 +#: ../content/pod_template.py:264 msgid "Select format in which the template will be generable." msgstr "" -#: ../setuphandlers.py:192 +#: ../setuphandlers.py:195 msgid "Spreadsheet template" msgstr "" @@ -315,7 +323,7 @@ msgstr "" msgid "Steps to ease tests of collective.documentgenerator" msgstr "" -#: ../content/pod_template.py:71 +#: ../content/pod_template.py:74 msgid "Style template" msgstr "" @@ -323,52 +331,52 @@ msgstr "" msgid "StyleTemplate" msgstr "" -#: ../setuphandlers.py:77 -msgid "Styles n°2" +#: ../setuphandlers.py:80 +msgid "Styles n°2" msgstr "" #: ../profiles/base/types/SubTemplate.xml msgid "SubTemplate" msgstr "" -#: ../browser/controlpanel.py:59 -#: ../content/pod_template.py:305 +#: ../browser/controlpanel.py:67 +#: ../content/pod_template.py:308 msgid "Table column modifier" msgstr "" -#: ../content/pod_template.py:167 +#: ../content/pod_template.py:170 msgid "Template" msgstr "" -#: ../content/pod_template.py:277 +#: ../content/pod_template.py:280 msgid "Templates to merge." msgstr "" -#: ../content/pod_template.py:289 +#: ../content/pod_template.py:292 msgid "These context variables are added to the odt_file context." msgstr "" -#: ../content/pod_template.py:193 +#: ../content/pod_template.py:196 msgid "Value" msgstr "" -#: ../content/pod_template.py:188 +#: ../content/pod_template.py:191 msgid "Variable name" msgstr "" -#: ../content/pod_template.py:338 +#: ../content/pod_template.py:341 msgid "You can't select a POD Template or set this template reusable if you have chosen an existing POD Template." msgstr "" -#: ../content/pod_template.py:323 +#: ../content/pod_template.py:326 msgid "You can't use one of these words: ${list}" msgstr "" -#: ../content/pod_template.py:326 +#: ../content/pod_template.py:329 msgid "You have twice used the same name '${name}'" msgstr "" -#: ../content/pod_template.py:333 +#: ../content/pod_template.py:336 msgid "You must select an odt file or an existing pod template" msgstr "" @@ -384,27 +392,31 @@ msgstr "" msgid "collective.documentgenerator tests" msgstr "" -#: ../demo/helper.py:76 +#: ../demo/helper.py:72 msgid "comment" msgstr "" #. Default: "Element ${elem} is not valid for .${extension} template : \"${template}\"" -#: ../content/pod_template.py:219 +#: ../content/pod_template.py:222 msgid "element_not_valid" msgstr "" -#: ../demo/helper.py:74 +#: ../demo/helper.py:70 msgid "input_field" msgstr "" -#: ../demo/helper.py:84 +#: ../demo/helper.py:80 msgid "last_change" msgstr "" -#: ../browser/controlpanel.py:44 +#: ../browser/controlpanel.py:52 msgid "oo_port" msgstr "" -#: ../browser/controlpanel.py:51 +#: ../browser/controlpanel.py:45 +msgid "oo_server" +msgstr "" + +#: ../browser/controlpanel.py:59 msgid "uno path" msgstr "" diff --git a/src/collective/documentgenerator/locales/fr/LC_MESSAGES/collective.documentgenerator.po b/src/collective/documentgenerator/locales/fr/LC_MESSAGES/collective.documentgenerator.po index 7e46b44b..be4e128a 100644 --- a/src/collective/documentgenerator/locales/fr/LC_MESSAGES/collective.documentgenerator.po +++ b/src/collective/documentgenerator/locales/fr/LC_MESSAGES/collective.documentgenerator.po @@ -14,7 +14,7 @@ msgstr "" "Preferred-Encodings: utf-8 latin1\n" "Domain: DOMAIN\n" -#: ../utils.py:79 +#: ../utils.py:77 msgid "${error_message} for key = '${key}'" msgstr "${error_message} pour la clé '${key}'" @@ -26,15 +26,15 @@ msgstr "Un document qui contient les styles à incorporer dans un modèle de doc msgid "A document to generate on a content." msgstr "Un document à générer depuis un type de contenu." -#: ../browser/table.py:218 +#: ../browser/table.py:221 msgid "Actions" msgstr "Actions" -#: ../content/pod_template.py:269 +#: ../content/pod_template.py:272 msgid "Allowed portal types" msgstr "Types de contenu autorisés" -#: ../content/pod_template.py:260 +#: ../content/pod_template.py:263 msgid "Available formats" msgstr "Formats disponibles" @@ -50,27 +50,27 @@ msgstr "Impossible de créer un document persistant si le contexte n'est pas un msgid "Can't import python uno library with the python path" msgstr "L'importation de la librairie UNO dans votre environnement python a échoué" -#: ../browser/controlpanel.py:96 +#: ../browser/controlpanel.py:112 msgid "Cancel" msgstr "Annuler" -#: ../browser/controlpanel.py:93 +#: ../browser/controlpanel.py:109 msgid "Changes saved" msgstr "Changements enregistrés" -#: ../content/pod_template.py:245 +#: ../content/pod_template.py:248 msgid "Check if this POD Template can be reused by other POD Template" msgstr "Cocher si ce modèle canvas odt peut-être réutilisé dans d'autres modèles de documents POD" -#: ../content/pod_template.py:299 +#: ../content/pod_template.py:302 msgid "Choose the mailing loop template to apply for this template." msgstr "Sélectionnez le modèle de boucle de publipostage." -#: ../content/pod_template.py:72 +#: ../content/pod_template.py:75 msgid "Choose the style template to apply for this template." msgstr "Sélectionnez le fichier de style à utiliser pour ce modèle." -#: ../setuphandlers.py:162 +#: ../setuphandlers.py:165 msgid "Collection template" msgstr "Modèle collection" @@ -78,102 +78,110 @@ msgstr "Modèle collection" msgid "ConfigurablePODTemplate" msgstr "Modèle de document POD" -#: ../content/pod_template.py:288 +#: ../content/pod_template.py:291 msgid "Context variables." msgstr "Variables du contexte" -#: ../utils.py:76 +#: ../utils.py:74 msgid "Dict update collision on key" msgstr "Collision dans la mise à jour du dictionnaire" -#: ../browser/table.py:152 -#: ../content/vocabulary.py:93 +#: ../browser/table.py:155 +#: ../content/vocabulary.py:102 msgid "Disabled" msgstr "Désactivé" -#: ../content/vocabulary.py:96 +#: ../content/vocabulary.py:105 msgid "Distribute" msgstr "Distribuer" -#: ../content/pod_template.py:179 +#: ../content/pod_template.py:182 msgid "Do rendering" msgstr "Pré-rendu" -#: ../browser/controlpanel.py:82 +#: ../browser/controlpanel.py:98 #: ../profiles/base/controlpanel.xml msgid "Document Generator settings" msgstr "Configuration du générateur de document" -#: ../browser/controlpanel.py:98 +#: ../browser/controlpanel.py:114 msgid "Edit cancelled" msgstr "Édition annulée" -#: ../browser/table.py:140 -#: ../content/pod_template.py:64 +#: ../browser/table.py:143 +#: ../content/pod_template.py:67 msgid "Enabled" msgstr "Activé" -#: ../browser/generation_view.py:250 +#: ../browser/generation_view.py:297 msgid "Error when merging context_variables in generation context" msgstr "Erreur lors de la mise à jour du contexte de génération avec les variables de contexte" -#: ../browser/generation_view.py:248 +#: ../browser/generation_view.py:295 msgid "Error when merging helper_view in generation context" msgstr "Erreur lors de la mise à jour du contexte de génération avec la vue d'aide" -#: ../browser/generation_view.py:255 +#: ../browser/generation_view.py:437 msgid "Error when merging mailed_data in generation context" msgstr "Erreur lors de la mise à jour du contexte de génération avec la donnée à publiposter" -#: ../browser/generation_view.py:426 +#: ../browser/generation_view.py:502 msgid "Error when merging mailing_list in generation context" msgstr "Erreur lors de la mise à jour du contexte de génération avec les données à publiposter" -#: ../browser/generation_view.py:184 +#: ../browser/generation_view.py:202 msgid "Error when merging merge_templates in generation context" msgstr "Erreur lors de la mise à jour du contexte de génération avec les sous-modèles" -#: ../tests/test_generation_view.py:256 -msgid "Failing template" -msgstr "Failing template" +#: ../browser/controlpanel.py:86 +msgid "Force communication via in/out stream with LibreOffice." +msgstr "Forcer la communication avec LibreOffice via flux http." -#: ../content/vocabulary.py:118 +#: ../content/vocabulary.py:127 msgid "Force disabled" msgstr "Désactiver (ignorer la valeur globale)" -#: ../content/vocabulary.py:121 +#: ../content/vocabulary.py:130 msgid "Force distribute" msgstr "Distribuer (ignorer la valeur globale)" -#: ../content/vocabulary.py:119 +#: ../content/vocabulary.py:128 msgid "Force nothing" msgstr "Activé mais sans traitement par défaut (ignorer la valeur globale)" -#: ../content/vocabulary.py:120 +#: ../content/vocabulary.py:129 msgid "Force optimize" msgstr "Optimiser (ignorer la valeur globale)" -#: ../setuphandlers.py:124 +#: ../setuphandlers.py:127 msgid "General template" msgstr "Modèle général" #. Default: "global_value" -#: ../content/vocabulary.py:113 +#: ../content/vocabulary.py:122 msgid "Global value (${global_value})" msgstr "Utiliser la valeur globale (${global_value})" -#: ../setuphandlers.py:92 +#: ../setuphandlers.py:95 msgid "Header" msgstr "En-tête" -#: ../browser/controlpanel.py:18 +#: ../browser/controlpanel.py:46 +msgid "IP address or hostname of OO." +msgstr "Adresse IP du serveur LibreOffice" + +#: ../browser/controlpanel.py:19 msgid "If enabled, this will allow the \"table-layout: fixed|auto|none\" CSS style handling while generating document. If no such style is defined on the table, the chosen column modifier of LibreOffice will be applied." msgstr "Si activé, ceci autorisera le traitement des styles CSS \"table-layout: fixed|auto|none\" lors de la génération de document. Si aucun style n'est défini sur la table, le traitement de largeur de colonne LibreOffice choisi sera appliqué." -#: ../browser/controlpanel.py:68 +#: ../browser/controlpanel.py:76 msgid "If enabled, this will avoid generating a document containing an error, instead a common Plone error will be raised. Nevertheless to ease debugging, Managers will continue to get errors in the generated document if it uses .odt format." msgstr "Une fois activé, ceci évite qu'un document contenant une erreur soit généré, à la place, une erreur Plone sera produite. Néanmoins, pour faciliter le déboguage, les administrateurs continueront à obtenir les erreurs dans les documents générés s'ils le sont au format .odt" +#: ../browser/controlpanel.py:87 +msgid "If enabled, this will force using stream to communicate witth LibreOffice server. This must be true if the LO server is not on localhost or is in a docker container." +msgstr "Quand activé, la communication avec LibreOffice se fera via flux http." + #: ../profiles.zcml:15 msgid "Installs the collective.documentgenerator add-on." msgstr "Installs the collective.documentgenerator add-on." @@ -194,8 +202,8 @@ msgstr "Numéro de téléphone non valide: '${nb}'" msgid "Linked POD Template using this one" msgstr "Modèle de document POD liés utilisant celui-ci" -#: ../content/pod_template.py:298 -#: ../setuphandlers.py:108 +#: ../content/pod_template.py:301 +#: ../setuphandlers.py:111 msgid "Mailing loop template" msgstr "Modèle de boucle de publipostage" @@ -203,15 +211,15 @@ msgstr "Modèle de boucle de publipostage" msgid "MailingLoopTemplate" msgstr "Modèle de boucle de publipostage" -#: ../browser/table.py:169 +#: ../browser/table.py:172 msgid "Modified" msgstr "Modifié" -#: ../setuphandlers.py:138 +#: ../setuphandlers.py:141 msgid "Multiple format template" msgstr "Modèle différents formats" -#: ../content/pod_template.py:215 +#: ../content/pod_template.py:218 msgid "No format selected" msgstr "Aucun format sélectionné" @@ -219,28 +227,28 @@ msgstr "Aucun format sélectionné" msgid "None" msgstr "Aucun" -#: ../content/vocabulary.py:94 +#: ../content/vocabulary.py:103 msgid "Nothing" msgstr "Activé mais sans traitement par défaut" -#: ../content/pod_template.py:52 -#: ../content/style_template.py:29 +#: ../content/pod_template.py:55 +#: ../content/style_template.py:28 msgid "ODT File" msgstr "Canevas" -#: ../content/vocabulary.py:95 +#: ../content/vocabulary.py:104 msgid "Optimize" msgstr "Optimiser" -#: ../browser/table.py:162 +#: ../browser/table.py:165 msgid "Original" msgstr "Original" -#: ../setuphandlers.py:41 +#: ../setuphandlers.py:44 msgid "POD Templates" msgstr "Modèles POD" -#: ../content/pod_template.py:173 +#: ../content/pod_template.py:176 msgid "POD context name" msgstr "Nom de variable du modèle" @@ -248,63 +256,63 @@ msgstr "Nom de variable du modèle" msgid "PODTemplate" msgstr "Modèle de document POD restreint" -#: ../browser/table.py:104 +#: ../browser/table.py:107 msgid "Path" msgstr "Chemin relatif" -#: ../browser/controlpanel.py:52 +#: ../browser/controlpanel.py:60 msgid "Path of python with uno." msgstr "Chemin d'un python avec la librairie uno" -#: ../browser/table.py:182 +#: ../browser/table.py:185 msgid "Pod formats" msgstr "Formats" -#: ../browser/controlpanel.py:45 +#: ../browser/controlpanel.py:53 msgid "Port Number of OO." msgstr "Indiquez le numéro du port sous lequel tourne Libre (ou Open) Office." -#: ../setuphandlers.py:209 +#: ../setuphandlers.py:212 msgid "Possibly mailed template" msgstr "Modèle qui peut être publiposté" -#: ../events/styles_events.py:96 +#: ../events/styles_events.py:98 msgid "Problem during styles update on template '${tmpl}': ${err}" msgstr "Erreur lors de la mise à jour des styles sur le modèle '${tmpl}': ${err}" -#: ../browser/controlpanel.py:67 +#: ../browser/controlpanel.py:75 msgid "Raise an error instead generating the document" msgstr "En cas d'erreur, produire une erreur Plone au lieu d'une erreur dans le document généré" -#: ../content/pod_template.py:244 +#: ../content/pod_template.py:247 msgid "Reusable" msgstr "Réutilisable" -#: ../setuphandlers.py:226 +#: ../setuphandlers.py:235 msgid "Reusable template" msgstr "Modèle réutilisable" -#: ../setuphandlers.py:245 +#: ../setuphandlers.py:254 msgid "Reuse Test Template" msgstr "Modèle utilisant le fichier ODT d'un autre modèle" -#: ../browser/controlpanel.py:85 +#: ../browser/controlpanel.py:101 msgid "Save" msgstr "Sauver" -#: ../content/pod_template.py:252 +#: ../content/pod_template.py:255 msgid "Select Existing POD Template to reuse" msgstr "Choisir un modèle de document POD existant à réutiliser" -#: ../content/pod_template.py:270 +#: ../content/pod_template.py:273 msgid "Select for which content types the template will be available." msgstr "Sélectionnez les types de contenus pour lesquels le modèle sera disponible." -#: ../content/pod_template.py:261 +#: ../content/pod_template.py:264 msgid "Select format in which the template will be generable." msgstr "Sélectionnez les formats dans lesquels le modèle pourra être généré." -#: ../setuphandlers.py:192 +#: ../setuphandlers.py:195 msgid "Spreadsheet template" msgstr "Modèle de tableur" @@ -312,7 +320,7 @@ msgstr "Modèle de tableur" msgid "Steps to ease tests of collective.documentgenerator" msgstr "Steps to ease tests of collective.documentgenerator" -#: ../content/pod_template.py:71 +#: ../content/pod_template.py:74 msgid "Style template" msgstr "Modèle de style" @@ -320,52 +328,52 @@ msgstr "Modèle de style" msgid "StyleTemplate" msgstr "Modèle de style" -#: ../setuphandlers.py:77 -msgid "Styles n°2" +#: ../setuphandlers.py:80 +msgid "Styles n°2" msgstr "" #: ../profiles/base/types/SubTemplate.xml msgid "SubTemplate" msgstr "Sous modèle" -#: ../browser/controlpanel.py:59 -#: ../content/pod_template.py:305 +#: ../browser/controlpanel.py:67 +#: ../content/pod_template.py:308 msgid "Table column modifier" msgstr "Modification sur les colonnes de tableaux" -#: ../content/pod_template.py:167 +#: ../content/pod_template.py:170 msgid "Template" msgstr "Modèle" -#: ../content/pod_template.py:277 +#: ../content/pod_template.py:280 msgid "Templates to merge." msgstr "Modèles à fusionner." -#: ../content/pod_template.py:289 +#: ../content/pod_template.py:292 msgid "These context variables are added to the odt_file context." msgstr "Ces variables sont ajoutées au contexte passé au modèle odt." -#: ../content/pod_template.py:193 +#: ../content/pod_template.py:196 msgid "Value" msgstr "Valeur" -#: ../content/pod_template.py:188 +#: ../content/pod_template.py:191 msgid "Variable name" msgstr "Nom de variable" -#: ../content/pod_template.py:338 +#: ../content/pod_template.py:341 msgid "You can't select a POD Template or set this template reusable if you have chosen an existing POD Template." msgstr "Vous ne pouvez pas définir un 'Canevas' ou définir ce modèle comme 'Réutilisable' si vous avez choisi un modèle dans la liste 'Choisir un modèle de document POD existant à réutiliser'." -#: ../content/pod_template.py:323 +#: ../content/pod_template.py:326 msgid "You can't use one of these words: ${list}" msgstr "Vous ne pouvez pas utiliser un de ces noms réservés: ${list}" -#: ../content/pod_template.py:326 +#: ../content/pod_template.py:329 msgid "You have twice used the same name '${name}'" msgstr "Vous avez déclaré 2 fois le même nom de variable: ${list}" -#: ../content/pod_template.py:333 +#: ../content/pod_template.py:336 msgid "You must select an odt file or an existing pod template" msgstr "Un des champs 'Canevas' ou 'Choisir un modèle de document POD existant à réutiliser' doit être rempli." @@ -381,27 +389,31 @@ msgstr "collective.documentgenerator demo" msgid "collective.documentgenerator tests" msgstr "collective.documentgenerator tests" -#: ../demo/helper.py:76 +#: ../demo/helper.py:72 msgid "comment" msgstr "Commentaire" #. Default: "Element ${elem} is not valid for .${extension} template : \"${template}\"" -#: ../content/pod_template.py:219 +#: ../content/pod_template.py:222 msgid "element_not_valid" msgstr "L'élément ${elem} est invalide pour l'extension .${extension} de votre canevas \"${template}\"" -#: ../demo/helper.py:74 +#: ../demo/helper.py:70 msgid "input_field" msgstr "Champs de saisie" -#: ../demo/helper.py:84 +#: ../demo/helper.py:80 msgid "last_change" msgstr "Dernière modification" -#: ../browser/controlpanel.py:44 +#: ../browser/controlpanel.py:52 msgid "oo_port" msgstr "Numéro du port Office" -#: ../browser/controlpanel.py:51 +#: ../browser/controlpanel.py:45 +msgid "oo_server" +msgstr "Serveur LibreOffice" + +#: ../browser/controlpanel.py:59 msgid "uno path" msgstr "Python uno" diff --git a/src/collective/documentgenerator/profiles.zcml b/src/collective/documentgenerator/profiles.zcml index d9eb4b1a..92b38b55 100644 --- a/src/collective/documentgenerator/profiles.zcml +++ b/src/collective/documentgenerator/profiles.zcml @@ -120,6 +120,16 @@ handler="collective.documentgenerator.migrations.migrate_to_9.migrate" /> + + + + diff --git a/src/collective/documentgenerator/profiles/plone4/metadata.xml b/src/collective/documentgenerator/profiles/plone4/metadata.xml index 76c749ce..6829a124 100644 --- a/src/collective/documentgenerator/profiles/plone4/metadata.xml +++ b/src/collective/documentgenerator/profiles/plone4/metadata.xml @@ -3,5 +3,5 @@ profile-collective.documentgenerator:install-base - 9 + 10 diff --git a/src/collective/documentgenerator/profiles/plone5/metadata.xml b/src/collective/documentgenerator/profiles/plone5/metadata.xml index 76c749ce..6829a124 100644 --- a/src/collective/documentgenerator/profiles/plone5/metadata.xml +++ b/src/collective/documentgenerator/profiles/plone5/metadata.xml @@ -3,5 +3,5 @@ profile-collective.documentgenerator:install-base - 9 + 10