1. 21 Nov, 2017 14 commits
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      multiple_catalog: Update tests · 670a59c4
      Ayush Tiwari authored
      670a59c4
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      multiple_catalog: Validate catalog while updrading/installing catalog objects · 8089570a
      Ayush Tiwari authored
      And, Handle exception cases for already validated catalog
      8089570a
    • Ayush Tiwari's avatar
      137e5b8f
    • Ayush Tiwari's avatar
      multiple_catalog: handle exception while unindexing objects when we don't have... · adc34ced
      Ayush Tiwari authored
      multiple_catalog: handle exception while unindexing objects when we don't have validation_state defined on catalog
      adc34ced
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      272b0be4
    • Ayush Tiwari's avatar
      Migration to ERP5 Catalog · 9c809286
      Ayush Tiwari authored
      Migrating current portal_catalog to erp5 object.    
      
      # Major changes :  
      
      - We have new classes for various objects based on base classes which we use for ERP5 objects.  
      
      | Old class | New class | Parent Class  | Portal Type |
      | ------------ | ------------- | ----------------- | ----------------|
      | CatalogTool | ERP5CatalogTool | BaseTool | Catalog Tool |
      | SQLCatalog | Catalog | ERP5Type.Folder | Catalog |
      | ZSQLMethod | SQLMethod | XMLObject | SQL method |
      
      - All the major attributes for these objects has been changed to properties. For these, we have some property_sheets added.  
        - **Catalog** : Properties like sql_clear_catalog, sql_search_result_keys, etc
        - **CatalogTool** : Properties like default_erp5_catalog_id, archive_path, etc
        - **SQLMethod** : Properties like arguments, templates, etc
        - **CatalogFilter** :  For CatalogMethod objects, we have added filter properties which earlier used to be an attribute of SQLCatalog saving object in PersistentMapping.   
      
      # Installation :  
      - **New ERP5 Instance** : For a new ERP5 instance, you get installed ERP5 Catalog Tool and ERP5 Catalog by default. Concerning sub-objects and python scripts, we have added an extra step in installation of `CatalogMethodTemplateItem` (mentioned in next section). This part is conversion of catalog methods to ERP5 objects.
      This adds little extra time to installation of BT5 containing catalog methods.
      - **Running ERP5 Instance**:  We migrate the objects(`portal_catalog` as well as its sub objects) dynamically to the new portal_types, thanks to usage of `__of__` and `__bootstrap`.  Concerning dynamic migration,  it is handled via `synchronizeDynamicModule` function, which cover all steps in a transaction, hence any error in between rolls back the changes.
      
      # Migration Steps for running instance :  
      1. Rebase your erp5 repository on new code.
      2. Restart `zope` process.
      3. Wait for activities to finish. Thereafter you can check from `portal_catalog/manage_main` that we have catalog and sub-objects as ERP5 objects.
      But you still won't be able to see the `view` for those objects, so we move to next step of upgrading Business Templates. *It is normal to get error that catalog view is unaccessible*. You can check if you get this error both for `portal_catalog` as well as `erp5_mysql_innodb` also.
      4. Restart `zope` process **again**.
      5. Update `genbt5list`.
      6. In template tool, upgrade business templates and upgrade `erp5_core` Business Templates. Wait for activities to finish(may take some time, 1-2 mins). After that, you are good to go and use ERP5 Catalog.
      
      **Changes in bt5 installation for CatalogMethodTemplateItem**  
      - When we don't have default catalog installaed :   
      *Use case: Installation of BT5 during  ERP5 setup*  
      In this case, while installation of `erp5_mysql_innodb_catalog`, we create the catalog and install all CatalogMethodTemplateItem there. Also, in the mean process, we convert the zsql methods and script(python) to erp5 objects. This process is only carried once, i.e at the installation of catalog. This is done in `ObjectTemplateItem.install` function
      - When we have `ERP5 Catalog` installed :  
      *Use case: Installing BT5 containing ZSQL Method while we have ERP5 Catalog installed*  
      We use `install` function for `Class CatalogMethodTemplateItem` in this case. Here, we check for `aq_parent` of the catalog method and if it is an 'ERP5 Catalog', we convert it to erp5 objects.
      
      # Performance :   
      - Adding extra step in BT5 installation adds some extra time to performance.
      - Because, in every erp5 objects, object lookup is done via `_getOb` rather than `__getattr__`, so this adds a bit in improving performance.
      - Overall, we lose around 2~3% performance.
      
      # Problem pertaining/Limitations :  
      - Need to restart erp5_site before upgrading BT5(s) -  Current structure of migration uses `__of__` function to migrate catalog which in turn makes a call to generation of dynamic classes for catalog object. This is where it calls `_importClass` method, which ends up calling `setDefaultClassProperties` function on multiple layer of classes including `ERP5Site`. Thus, we end up having `isRADContent` for portal object which comes as a hindrance when we try to index objects in acquisition such as `portal_skins`, etc.
      
      # Extra points to be noted :  
      - `Catalog` object shouldn't be indexable(because of the problem which may arise due to circular dependency).
      - Dynamic migration keeps all the old attributes for now, so as not to lose any user made change. 
      
      # Concerning Links :  
      - Documentation WebPage                   :  https://www.erp5.com/erp5-Migrating.erp5.catalog  
      - Test Suite                                                    :  https://nexedi.erp5.net/test_suite_module/284   
      - Latest Test Result                                    :  https://nexedi.erp5.net/test_result_module/20171120-61F85D0C
      - Latest Performance Result                  :  https://nexedi.erp5.net/test_result_module/20171120-2615A7B
      
      
      /reviewed-on nexedi/erp5!178
      9c809286
  2. 20 Nov, 2017 9 commits
    • Ayush Tiwari's avatar
      9e53f10c
    • Ayush Tiwari's avatar
      erp5_catalog: Dynamic migration of ZMI catalog to ERP5-ified catalog · 7d897440
      Ayush Tiwari authored
      And, Patch changeObjectClass extension to remove useless attributes
      
      Copying __dict__ from one object to another brings us to situation where
      we don't have many objects which we don't need at all, for example, migrating
      objects with subclasses who were initially OFS objects and later an ERP5
      object can lead to adding subobjects as attributes of the new object, which
      is completely undesirable. To handle this, it is important to delete the
      sub-objects as the attributes for those migrated classes.
      
      Old Catalog Tool didn't have portal_type attribute, so while migrating
      via synchronizeDynamicModule, after _bootstrap, we expect the tool to
      have a portal_type to finalize migration.
      
      This step is now being done only at the end of _bootstrap after we
      change the classes for portal_catalog and its sub-objects.
      7d897440
    • Ayush Tiwari's avatar
      064d305a
    • Ayush Tiwari's avatar
      [erp5_core]: Add action and property sheet for Python Script portal_type · c1787c0c
      Ayush Tiwari authored
      Also, add condition to display the view only when the container is 'ERP5 Catalog'
      c1787c0c
    • Ayush Tiwari's avatar
      [erp5_core]: Add SQL Method portal_type · ed423e7e
      Ayush Tiwari authored
      ed423e7e
    • Ayush Tiwari's avatar
      erp5_catalog: Rename reindexObject method to use them as new methods for CatalogTool. · 1200801e
      Ayush Tiwari authored
      - This step is needed due to the use of BaseTool as Base class for CatalogTool
        due to which there were conflict between reindexObject from the Base and the one
        from the BaseTool.
      1200801e
    • Ayush Tiwari's avatar
      ERP5CatalogTool: ERP5-ify CatalogTool · 4872db70
      Ayush Tiwari authored
      ERP5CatalogTool class inherits from BaseTool.
      
      Significant addition/changes in:
      -------------------------------
        ERP5CatalogTool:
          Add functions _isBootstrapRequired and _bootstrap
          Explicilty add manage option tabs in Catalog Tool
      
        BusinessTemplate:
          Update BusinessTemplate installation according to changes made in ERP5Catalog and Tool
      
        testCopySupport:
          Its better to change the tests where they need to call getpath function of
          portal_catalog to use portal_catalog.getpath instead of portal_catalog.getPath,
          as we have overridden the 'getPath' function for CatalogTool class due to change
          in inheritence.
      
        ERP5Site:
          Create portal_catalog while setting up erp5site
      4872db70
    • Ayush Tiwari's avatar
      Products.ERP5Catalog: EPR5-ify catalog. · 557c20bd
      Ayush Tiwari authored
      Move from SQLCatalog to ERP5Catalog as the default Catalog inside ERP5.
      The major difference is use of Products.ERP5Type.Core.Folder as Catalog
      base class.
      
      Significant addition/changes in
      -------------------------------
      
        ERP5Catalog class:
          Inherit from Catalog class from Products.ZSQLCatalog.SQLCatalog instead of copy-pasting the whole code again.
          Monkey patch some property setters and getters to maintain consistency
          Override getCatalogMethodIds cause it uses global variable in SQLCatalog.Catalog
          Add FilterDict and Filter class to have consistency with `filter_dict` attribute of SQLCatalog
      
        BusinessTemplate:
          Update BusinessTemplate installation with updated filter_dict
          Also, use dynamic migration while installing the catalog method objects for
          bt5. This way we have SQL Methods migrated just after installation.
      
        Tests:
          Update tests according to changes in portal_catalog
      
        SQLCatalog, testZSQLCatalog:
          Cleanup for unusable functions
      557c20bd
    • Ayush Tiwari's avatar
      Products.ERP5.Document: Add SQLMethod class · c2809b85
      Ayush Tiwari authored
      Create the SQLMethod class based on ZSQLMethods.SQL
      class and XMLObject.
      c2809b85
  3. 17 Nov, 2017 2 commits
  4. 16 Nov, 2017 15 commits