1. 30 May, 2017 30 commits
    • Ayush Tiwari's avatar
      erp5_catalog: Remove usage of default_sql_catalog_id attribute from ERP5CatalogTool class · 64cd361d
      Ayush Tiwari authored
      For compatibilty, we have added 2 extra functions, but in no way we need
      to use this attribute as it doesn't give any meaning for ERP5CatalogTool
      to have a default SQL Catalog.
      64cd361d
    • Ayush Tiwari's avatar
      sql_catalog: Drop usage of getattr from SQLCatalog · b76b4743
      Ayush Tiwari authored
      This would increase compatibility between accessors in erp5_catalog and
      remove the need of copy and patch. At the same time, it also helps in
      increasing performance as using _getOb is always less costly than
      getattr, as it reduces the need to look in acquisition.
      b76b4743
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: [WORKAROUND] Explicitly call reset for component_tool in test. · e814a816
      Ayush Tiwari authored
      After adding document component object, _p_oid was bing generated at the
      last step of commit hook. This led to problem that _registry_dict for
      dynamic_class 'erp5.component.document' wasn't getting updated with
      the _p_oid of the component created. This led to failing of test because
      to validate object with same reference, the checkConsistency function
      checks in the _registry_dict for reference and _p_oid.
      
      Explicilty calling commit here generates the oid before validation, hence
      make it available for the registry_dict in time.
      
      But, this clearly is a workaround which is clearly not solving the real
      problem of why the _p_oid isn't being generated at the right step.
      
      Also, me(Ayush), tried to recreate this error on a running instance, but
      it worked fine there.
      e814a816
    • Ayush Tiwari's avatar
      erp5_catalog: Do not use lazy_class objects while generating UIDs · 5424a809
      Ayush Tiwari authored
      Earlier, class for any Catalog object used to be Products.ZSQLCatalog.SQLCatalog,
      but now as we have shifted SQLCatalog to ERP5Catalog, the catalog objects have
      lazy_class 'erp5.portal_type.Catalog' as their 1st class in mro. This class
      don't have the required attributes.
      
      The lazy_class is dynamic, so its not possible for them to save reserved IDs
      as their attributes. So, we use the next class in mro, which would be
      class 'Products.ERP5Catalog.ERP5Catalog' and save attributes in it.
      
      Notice that this change of 'self.__klass__' is not required if
      we are starting a lock with '_reserved_uid_lock' and then acquire-release it
      consicutively in one go(transaction).
      5424a809
    • Ayush Tiwari's avatar
      erp5_catalog: Refactor _catalogObject List to remove the need to copy and patch · 05eed266
      Ayush Tiwari authored
      Create FilterDict and Filter class which would be used to imitate the behaviour
      of filter_dict for Catalog.
      
      /suggested by @jm
      05eed266
    • Ayush Tiwari's avatar
      erp5_catalog: Dynamic migration · a5fda48a
      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 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.
      
      erp5_catalog: Refactor _bootstrap for Catalog Tool
      
      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.
      
      And, changes to improve performance while dynamic migration.
      
      XXX: Still at this point we are not doing the same thing with
      sub-objects of catalog tool and wait till business template
      installation.
      
      erp5_catalog: Update attributes of the portal_catalog object after migration
      a5fda48a
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: Use getattr to get catalog attributes · 380a44a3
      Ayush Tiwari authored
      One of the difference between SQL and ERP5 Catalog is how they
      handle their properties. For ERP5Catalog, we use property_sheets
      which generate setters and getters, for SQLCatalog, properties
      just act as attributes(as one can expect from a property set
      on a class).
      
      This creates a difference on how we use them, especially for
      list_type properties, which have accessors like get<PropertyName>List
      to get the list of objects. For SQLCatalog, there is no such thing.
      This creates problem whereever 'get<PropertyName>' or getProperty(<name>)
      was being used to get multiple property types.
      
      So, we changed this to rely on getattr for the Python Scripts in this
      commit. Note that, getattr isn't good if we care about performance,
      but given that its used only twice, this can be better than adding
      extra function overhead.
      380a44a3
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      f07b1cd4
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: Update tests according to the changes in ERP5Catalog · 1254f331
      Ayush Tiwari authored
      Also, add test for migration in testERP5Catalog(as the first test to be run)
      and migrate Catalog in afterSetup in testERP5CatalogSecurityUidOptimization.
      1254f331
    • Ayush Tiwari's avatar
      erp5_catalog: Add CatalogFilter property_sheet to PythonScript class · 33a50438
      Ayush Tiwari authored
      Use filter attributes as property. Same as done for ERP5 SQL Methods.
      This way maintains consistency between sub-objects of Catalog, i.e,
      SQL Method and Python Script.
      33a50438
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: Update BusinessTemplate installation with updated filter_dict · 1bcc6825
      Ayush Tiwari authored
      This removes the need to copy-patch or if-else on meta_type of catalog.
      Use dynamic migration while installing the catalog method objects for
      bt5.
      1bcc6825
    • Ayush Tiwari's avatar
      erp5_catalog: Update erp5_core business template · 94fe5e1b
      Ayush Tiwari authored
      Contains views, property sheets,  portal types concerning migration of
      portal_catalog, sql catalog and their subobjects to erp5 object.
      
      Portal Types:
      1. Catalog : ERP5 Catalog object (an ERP5 Folder), which earlier used to be OFS Folder.
      	Actions:
      		Update Catalog
      		Clear Catalog
      		Clear Reserved
      		Export Properties
      
      2. Catalog Tool: Portal Catalog where we can add and use multiple ERP5 catalogs.
      	Actions:
      		Hot ReindexAll
      
      3. SQL Method: SQL methods with their views inside erp5.
      	Actions:
      		Run Method
      
      Property Sheet:
      1. Catalog
      2. CatalogTool
      3. SQLMethod
      	Containing properties for the various portal_types/classes respectively.
      4. CatalogFilter
      
      Also, filter_dict for erp5_catalog would now not be a Persistent Mapping
      object. The info inside filter_dict is being saved inside the SQL Method
      objects as their properties.
      
      Views:
      1. Catalog (View)
      2. CatalogTool(View, Properties, Filtered Items), Object Actions
      3. SQLMethod (View, Filter)
      4. Python Script (Filter)
      
      Extras:
      
      	- Dialog view for catalog before clear_catalog
      
      	- Add typeBaseMethod(s) for PythonScript and SQLMethod portal types:
      The methods <portal_type>_getRedirectParameterDictAfterAdd are required for these
      portal_types, cause their __call__ methods are overridden, so after addition
      of new objects for them, it was taking to the url concerning wherever __call__
      methods directed them.
      Now, we change them to redirect to 'abosulte_url+'/view'' which is basically
      the homepage for these catalog methods.
      
      	- Do not use default ERP5 Catalog to show properties:
      Earlier, in tales for properties for any erp5 catalog, we showed
      the values for the default_erp5_catalog. But keeping in mind that
      we can have multiple catalogs at same time, the old approach
      was wrong. Hence, we now display properties for the current catalog
      
      	- Search fo Catalog_viewContentList and Catalog_viewFilterList
      94fe5e1b
    • Ayush Tiwari's avatar
      erp5_catalog: Update testCopySupport according to changes in portal_catalog · 48962657
      Ayush Tiwari authored
      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 inherited class.
      48962657
    • Ayush Tiwari's avatar
      erp5_catalog: Rename reindexObject method to use them as new methods for CatalogTool. · b551f15c
      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.
      b551f15c
    • Ayush Tiwari's avatar
      erp5_catalog: New ERP5CatalogTool based on BaseTool from ERP5Type · 3d7c7388
      Ayush Tiwari authored
      	- Remove copy-pasting all code from CatalogTool, better to rely on inheritence
      	- Remove unnecessary imports
      	- Add argument id in __init__ class
      	- Add functions _isBootstrapRequired and _bootstrap
      	- Update BusinessTemplate installation according to changes made in ERP5Catalog and Tool
      	- Explicilty add manage option tabs in Catalog Tool
      3d7c7388
    • Ayush Tiwari's avatar
      Products.ERP5Catalog: EPR5-ify catalog. · 8a4496f5
      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 changes:
      	-Inherit from Catalog class from Products.ZSQLCatalog.SQLCatalog instead of copy-pasting the whole code again.
      	-Add allowed_types for ERP5Catalog tool
      	-Monkey patch some property setters and getters to maintain consistency
      	-Update id and title for ERP5Catlog while class initialization
      	-Set declarative securities and solve some inheritance conflicts
      	-Add isRADContent for ERP5Catalog Class
       	-Solve inheritence conflict for _setPropValue function in ERP5Catalog class
      	-Add SQL Method portal_type in allowed_types for ERP5Catalog class
      	-Override getCatalogMethodIds cause it uses global variable in SQLCatalog.Catalog
      	-Redefine security declarations
      	-Add functions for object_actions of Catalog portal_type in ERP5Catalog object
      	-Add filter_dict and _properties attributes for compatibilty
      8a4496f5
    • Ayush Tiwari's avatar
      Products.ERP5.Document: Add SQLMethod class · 202dd103
      Ayush Tiwari authored
      Create the SQLMethod class based on ZSQLMethods.SQL
      class and XMLObject. Also, move attributes to
      property in 'SQL Method' property sheets.
      202dd103
    • Ayush Tiwari's avatar
      Products.ZSQLCatalog: Make several schema-related methods public. · 766a7b31
      Ayush Tiwari authored
      These methods will be used in erp5 catalog view in restricted environment.
      Loosen the security on methods which we will use in erp5 catalog view in
      restricted environment. As suggested by \@vpelletier, this should be
      accepted as all methods were restricted by default earlier.
      766a7b31
    • Ayush Tiwari's avatar
      testERP5Catalog: Follow style guildelines · 17feb735
      Ayush Tiwari authored
      17feb735
    • Ayush Tiwari's avatar
      Products.ZSQLCatalog.SQLcatalog: Add function to get normal or deferred connection id for catalog · fc160321
      Ayush Tiwari authored
      And, change in files where this was being used
      fc160321
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      Products.ZSQLCatalog.SQLCatalog: Make SQLCatalog not rely on isIndexable from ERP5Site · ee6475c1
      Ayush Tiwari authored
      Earlier, In ERP5Site, we use property 'isIndexable' to have control over indexing and unindexing.
      This was usefull specially in case of bootstrap. To have this control, we had a function
      `isIndexable` in SQLCatalog which we used to switch for enabling-disabling indexation. (769f9fb2)
      
      This is a preparative commit for case where:
      Now, as we move to ERP5 based Catalog, which itself is an ERP5 Object, hence it has an accessor `isIndexable`
      of itself which we plan to disable for now(as we don't want circular dependency while indexing
      catalog in itself). But as we did have a function `isIndexable` in SQLCatalog which had control
      over the indexing, we needed to rename this property for ERP5Site.
      
      Hence, now we use property 'isIndexingRequired' for ERP5Site and use to have overall control
      over indexing process.
      
      Please note, we do not intend to change the same property name for any other object. Its just
      for ERP5Site.
      ee6475c1
    • Ayush Tiwari's avatar
      Products.ZSQLCatalog.SQLCatalog: Remove global and use default values instead. · 9a51faae
      Ayush Tiwari authored
      This would also remove the need of evaluating the globals every time.
      9a51faae
    • Tristan Cavelier's avatar
      erp5_officejs: improve WebSection_getDocumentValue behavior + test · 9a188fd1
      Tristan Cavelier authored
      to fit original script behavior, from erp5_web skin folder.
      Also fixes "KeyError: TraversalRequestNameStack" from
      `WebPage.getDocumentValue(reference)` on the "View" skin selection.
      9a188fd1
  2. 29 May, 2017 10 commits