1. 29 Oct, 2019 3 commits
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
      ZODB Components: Enable checking of imports with pylint. · 1cb2dc4c
      Arnaud Fontaine authored
      Until now it was disabled which means that if Component A imports Component B
      and the latter is not in {validated,modified} state, Component A could be
      validated without raising any error and failed at execution time.
      As this relies on Pylint transform/hook and avoiding monkey patch as much
      as possible, make Products.ERP5Type.patches.pylint available for Python3 (not
      actually tested with ERP5 but no AttributeError nor ImportError with Python3
      with this code).
      Also, allow developer to call validate action from 'modified' state to handle
      import use case:
        1. Edit A which raises an error stating that B.
        2. Fix B and validate it.
        3. Validate again A without requiring a modification of {reference,version,text_content}.
    • Arnaud Fontaine's avatar
      ZODB Components: Source code was checked even when setting... · 88a03532
      Arnaud Fontaine authored
      ZODB Components: Source code was checked even when setting text_content_{error,warning}_message_list properties.
      So only check source code and validate when _set{TextContent,Reference,Version}
      are called and remove wildcards.
  2. 25 Oct, 2019 1 commit
  3. 23 Oct, 2019 1 commit
    • Arnaud Fontaine's avatar
      Introduce HTML to PDF Transform through Conversion Server (currently using wkhtmltopdf) (MR !955). · fb9a0d60
      Arnaud Fontaine authored
      Conversion Server code is no longer bound to OOo, as emphasized by:
        * Renaming of Preference Properties ooodoc_server* to document_conversion_server*.
        * Conversion Server exceptions are already defined in Document.py.
        * Conversion Server also handles video/audio/... conversions.
      Thus, refactor the code to connect to Conversion Server by moving it from
      Products.ERP5OOo.Document to Products.ERP5.Document.Document (while keeping
      backward compatibility):
        * Renamed:
          + OOoServerProxy => DocumentConversionServerProxy
        * Moved:
          + enc
          + dec
          + global_server_proxy_uri_failure_time
      Also, Introduced erp5.module.TransformLib (in erp5_core as currently all Transforms
      are there even though it should probably not be so) to define DocumentConversionServerTransform
      and which will hold libtransforms content when this will be moved to ZODB Components.
      Note: Ideally, OOOdCommandTransform should inherit from DocumentConversionServerTransform
      but wkhtmltopdf Handler on Cloudooo side is a hack only implemented in Manager.convertFile()
      whereas OOOdCommandTransform still uses legacy Manager.run_generate(), so leave it as it is
      to avoid breaking things (this will be addressed in a separate MR).
      /reviewed-on !955
  4. 17 Oct, 2019 2 commits
    • Arnaud Fontaine's avatar
      ZODB Components: Add 'Origin' (source_reference) field showing from which FS... · cf632afb
      Arnaud Fontaine authored
      ZODB Components: Add 'Origin' (source_reference) field showing from which FS module it was imported.
    • Arnaud Fontaine's avatar
      ZODB Components: Do not validate nor check {consistency,source code} after importing from FS. · 799da311
      Arnaud Fontaine authored
      * pylint may return a false positive error which have to be disabled and
        failing to import it because of that requires to edit on the FS and try
        again so it is not practical for a whole Product. Instead it is easier
        to import it and not validate
      * Validation was done only for 'Test Component' and 'Extension Component',
        but all imported Components had their consistency and source code checked
        and this is not consistent to not validate but do these checks.
      * importFromFilesystem() was checking consistency and source code, and this
        was done again when validating.
      So leave the imported ZODB Components as draft and let the developer fixes
      issues upon validation before committing.
  5. 16 Oct, 2019 1 commit
    • Arnaud Fontaine's avatar
      ZODB Components: List of migratable 'Module Components' in Products.XXX.*... · f675c0fb
      Arnaud Fontaine authored
      ZODB Components: List of migratable 'Module Components' in Products.XXX.* should include any kind of objects and not only modules.
      This fixes Products.ERP5VCS.Git module not being displayed because
      Products.ERP5VCS.__init__ only imports one of its class and not the whole
      module (and the module was not imported anywhere else too) so it was not in
  6. 15 Oct, 2019 2 commits
  7. 11 Oct, 2019 1 commit
  8. 10 Oct, 2019 1 commit
  9. 09 Oct, 2019 3 commits
    • Arnaud Fontaine's avatar
      ZODB Components: Monkey patch pylint to avoid 'No config file found, using... · b58aeb23
      Arnaud Fontaine authored
      ZODB Components: Monkey patch pylint to avoid 'No config file found, using default configuration' on stderr.
      Another solution could have been to have a configuration file for pylint instead
      of command line arguments but it depends on the type of Component (for example
      'Interface Component' has specific arguments).
    • Arnaud Fontaine's avatar
      ZODB Components: Migrate ERP5ShortMessage Product and fix pylint warnings. · f83f35e4
      Arnaud Fontaine authored
      After upgrading bt5s, portal_sms may still ERP5BaseBroken until restarting Zope.
    • Arnaud Fontaine's avatar
      ZODB Components: Allow migration of {Interface,Mixin,Module,Tool} from... · d8961c51
      Arnaud Fontaine authored
      ZODB Components: Allow migration of {Interface,Mixin,Module,Tool} from Business Template UI and on all Products (not only Products.ERP5).
      This introduces the following new ZODB Components:
        + Module Component: Non-Documents/non-persistent classes of modules usually
          found at the top-level of Products (eg Products.ERP5.XXX) on FS. Considering
          that all other Components types are actually Modules, make it the base class.
        + Tool Component: Tool directory of Products on FS (eg Products.ERP5.Tool.XXX).
          => DiffTool and CallableTool are now 'Tool Component' instead of plain
             'Document Component' and properly registered as Tools like FS Products Tool.
      Skip CMFActivity and HBTreeFolder2 Products for now in migration View for now as
      almost many Portal Type classes have ActiveObject or HBTreeFolder2 in their MRO
      and these Products will be done at the end anyway...
  10. 08 Oct, 2019 2 commits
  11. 07 Oct, 2019 3 commits
  12. 05 Oct, 2019 1 commit
    • Arnaud Fontaine's avatar
      ZODB Components: Prepare ERP5ShortMessage Product for migration from FS. · 1ee08278
      Arnaud Fontaine authored
      * Add erp5_core_proxy_field_legacy to dependencies (because of (at least) my_password).
      * Rename ERP5ShortMessage.Errors module because the name is too generic for a 'Module Component'.
      * Fix type_class of SMSTool: This should be the name of the class only, excluding the module.
      * Add missing __init__.py to tests directory so that it can be migrated.
  13. 04 Oct, 2019 4 commits
    • Julien Muchembled's avatar
      Optimize WorkflowHistoryList · 1ca655a3
      Julien Muchembled authored
      This is done by inheriting most of the code of ConflictFreeLog,
      i.e. using a doubly-linked list:
      - for fast iteration of the first elements, and in particular
        immediate access to the first element (used for creation date);
      - that keeps track of the history length;
      - that implement fast reverse iteration (although it could
        have been done without changing the data structure).
      The size of buckets is not fixed anymore to 16 items:
      like ConflictFreeLog, WorkflowHistoryList is also a good candidate
      to look at the estimated serialized size of the bucket in order to
      decide if elements should be added to a new one or not.
      Then developers won't have to care about using Pdata or not.
      The size is bigger than the ConflictFreeLog default,
      because workflow items look a lot alike and adding
      a few more is cheap when the ZODB compresses.
      No more optimized __getstate__ (except for workflow histories that
      have not been migrated) so BT export will be a bit more verbose.
      The BBB code is because of
      /reviewed-on !941
    • Arnaud Fontaine's avatar
      ZODB Components: Before migrating Interfaces from FS, there must be one... · 694c9fee
      Arnaud Fontaine authored
      ZODB Components: Before migrating Interfaces from FS, there must be one Interface class per source file matching its name.
      Same as Document class: this avoids registering Interfaces at startup and just do it
      when using the Interface. In assuming that portal_components/XXX has a class
      name equals to XXX.getRference(), it is easier to:
       * List all existing Interfaces (for example in Portal Type Class view): getReference()
         on all validated 'Interface Component' in portal_components.
       * Lookup for an 'Interface Component': 'from erp5.component.interfaces.XXX import XXX'.
    • Arnaud Fontaine's avatar
      ZODB Components: Properly handle addition of template_* properties in... · d9627917
      Arnaud Fontaine authored
      ZODB Components: Properly handle addition of template_* properties in BusinessTemplate PropertySheet.
      On the plus side, this avoids an ugly 'except AttributeError: pass' which does
      not work anyway with the scenario below.
      Assuming the following:
        * template_XXX Property (accessor: getTemplateXXX) recently added to BusinessTemplate PropertySheet.
        * erp5_YYY sets template_A Property (erp5_YYY/bt/template_XXX.xml).
        This commit handles the following:
          1. Stop instance with old ERP5 without template_XXX.
          2. Update erp5.git.
          3. Start instance.
          4. Upgrade erp5_property_sheets and erp5_YYY bt5s in *one* transaction from portal_templates UI.
          => When upgrading erp5_YYY, BusinessTemplate.importFile() imports erp5_YYY/bt/*.xml where the
             list of files is based on BusinessTemplate class propertyMap(), but at this point accessors
             have not been re-generated yet, thus template_XXX is not returned by propertyMap() and
             erp5_YYY/bt/template_XXX.xml is not imported.
             => portal_templates/erp5_YYY new BT does not have template_XXX property set at all.
    • Arnaud Fontaine's avatar
      runUnitTest: 6f1c45c6 wrongly assumed that '--erp5_sql_connection_string' is always passed. · a3c40d0b
      Arnaud Fontaine authored
      This is the case with runUnitTest wrapper created by SlapOS but is not actually required
      as manage_addERP5Site has 'test test' as default value.
      This fixes:
        File "custom_zodb.py", line 70, in <module>
          sql_db = Products.ZMySQLDA.db.DB(os.environ['erp5_sql_connection_string'])
        File "UserDict.py", line 40, in __getitem__
          raise KeyError(key)
      KeyError: 'erp5_sql_connection_string'
  14. 02 Oct, 2019 3 commits
  15. 30 Sep, 2019 5 commits
  16. 27 Sep, 2019 1 commit
  17. 26 Sep, 2019 3 commits
  18. 25 Sep, 2019 3 commits
    • Julien Muchembled's avatar
      qa: speed up testERP5TypeInterfaces · d222b4f6
      Julien Muchembled authored
    • Julien Muchembled's avatar
    • Xiaowu Zhang's avatar
      portal_type_class: possible to overwrite methods or properties in mixin · b6b517ee
      Xiaowu Zhang authored
      Before this change, class hierarchy is like this when using mixin:
      class MyClass(BaseClass, Mixin1....)
      which is usually ok when classes don't override each other's
      But if we want to overwrite BaseClass's method by using mixin to do more thing,
      For example:
      class BaseClass(object):
        def test(self):
          print 'base test'
      class Mixin1(object):
        def test(self):
          print 'mixin'
      I want to display 'mixin base test' when call test, but it doesn't work
      since priority of how methods are resolved is from left
      to right: BaseClass----->Mixin1, it only display 'base test'
      So the correct way to use mixin should be in reverse order:
      class MyClass(Mixin1, BaseClass)
      /reviewed-on !935