Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 140
    • Merge requests 140
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1195

Closed
Created Jul 10, 2020 by Jérome Perrin@jeromeOwner
  • Report abuse
Report abuse

WIP: Support control characters in odf syles

  • Overview 4
  • Commits 6
  • Changes 6

if for some reason an ERP5 document has some control characters in title of description and is exported in ODS/ODT, the export will fail with an etree error like this:

Exception:
  Module Products.CMFActivity.ActivityTool, line 356, in __call__
      result = method(*self.args, **self.kw)
  Module Products.ERP5Type.patches.PythonScript, line 179, in __call__
      return self._orig_bindAndExec(args, kw, None)
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
      return self._exec(bound_data, args, kw)
  Module Products.PythonScripts.PythonScript, line 344, in _exec
      result = f(*args, **kw)
  Module script, line 15, in Base_renderSimpleView
  - <PythonScript at /erp5/Base_renderSimpleView used for /erp5/sale_packing_list_module>
  - Line 15
      report_data = getattr(context, deferred_style_dialog_method)(**params)
  Module AccessControl.ZopeGuards, line 369, in guarded_apply
      return builtin_guarded_apply(func, args, kws)
  Module AccessControl.ZopeGuards, line 391, in builtin_guarded_apply
      return func(*arglist, **argdict)
  Module Products.ERP5Form.Form, line 705, in __call__
      return pt.pt_render(extra_context=extra_context)
  Module Products.ERP5OOo.OOoTemplate, line 484, in pt_render
      extra_context, request)
  Module Products.ERP5OOo.OOoTemplate, line 422, in renderIncludes
      xml_doc = etree.XML(text)
  Module lxml.etree, line 3192, in lxml.etree.XML (src/lxml/lxml.etree.c:78763)
      
  Module lxml.etree, line 1848, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:118341)
      
  Module lxml.etree, line 1736, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:117021)
      
  Module lxml.etree, line 1102, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:111265)
      
  Module lxml.etree, line 595, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:105109)
      
  Module lxml.etree, line 706, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:106817)
      
  Module lxml.etree, line 635, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:105671)
      
  XMLSyntaxError: PCDATA invalid Char value 20, line 228761, column 21 (line 228761)

This is because XML does not accept the full range of characters, there are a few characters that are not allowed.

The approach here is to make ods and odt style rely more on field to build the ODF fragments, rather than doing everything in the page template. This way we can do the "sanitization" in a central place.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/control-characters-in-odf-syles
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7