1. 31 Aug, 2017 25 commits
    • Ayush Tiwari's avatar
      sql_catalog: Drop usage of getattr from SQLCatalog · 6106323a
      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.
      
      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.
      6106323a
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: [WORKAROUND] Explicitly call reset for component_tool in test. · c7eb3ab6
      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.
      c7eb3ab6
    • Ayush Tiwari's avatar
      erp5_catalog: Do not use lazy_class objects while generating UIDs · ccd387ff
      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).
      ccd387ff
    • Ayush Tiwari's avatar
      erp5_catalog: Dynamic migration · 32e3be52
      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.
      
      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.
      32e3be52
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      0e32c21f
    • Ayush Tiwari's avatar
    • Ayush Tiwari's avatar
      erp5_catalog: Add CatalogFilter property_sheet to PythonScript class · 2b08461c
      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.
      2b08461c
    • Ayush Tiwari's avatar
      erp5_catalog: Update erp5_core business template · 7758e940
      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
      7758e940
    • Ayush Tiwari's avatar
      erp5_catalog: Rename reindexObject method to use them as new methods for CatalogTool. · f482e666
      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.
      f482e666
    • Ayush Tiwari's avatar
      erp5_catalog: New ERP5CatalogTool based on BaseTool from ERP5Type · 3aaaeac4
      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
      
      - Update testCopySupport according to changes in portal_catalog
      
      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.
      3aaaeac4
    • Ayush Tiwari's avatar
      Products.ERP5Catalog: EPR5-ify catalog. · 1b72272d
      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 attribute for compatibilty
      
      Also,
      - Update BusinessTemplate installation with updated filter_dict
      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.
      - Update tests according to changes in portal_catalog
      - Create FilterDict and Filter class which would be used to imitate the behaviour
      of filter_dict for Catalog.
      1b72272d
    • Ayush Tiwari's avatar
      cdc4b195
    • Ayush Tiwari's avatar
      Products.ERP5.Document: Add SQLMethod class · 87394b81
      Ayush Tiwari authored
      Create the SQLMethod class based on ZSQLMethods.SQL
      class and XMLObject. Also, move attributes to
      property in 'SQL Method' property sheets.
      87394b81
    • Ayush Tiwari's avatar
      Products.ZSQLCatalog.SQLcatalog: Add function to get normal or deferred connection id for catalog · 6e7e12e0
      Ayush Tiwari authored
      And, change in files where this was being used
      6e7e12e0
    • Vincent Pelletier's avatar
      CatalogTool: Split getCategoryParameterDict in 2 · 79119142
      Vincent Pelletier authored
      One part working on {base_category_id: [document_value_set]}, and the other
      producing that structure out of a flat list of (base_category_id-prefixed)
      category relative urls.
      The former used to be included in the latter, but in some case caller
      already has the documents handy instead of only urls, in which case we can
      avoid a layer of document lookups.
      79119142
    • Vincent Pelletier's avatar
      testERP5Commerce: Prepare fixing isEmptyCriterionValid. · 06af6169
      Vincent Pelletier authored
      Site template sections are created without any predicate criterion.
      It happens to currently work, but for the wrong reasons. Arm this flag
      instead.
      06af6169
    • Vincent Pelletier's avatar
      testKM: Fix web section predicate membership criterion category · fbd086f2
      Vincent Pelletier authored
      follow_up/1 is an invalid relation. follow_up/project_module/1 is a valid
      relation.
      fbd086f2
    • Xiaowu Zhang's avatar
      erp5_multimedia: add new bt · 3939d052
      Xiaowu Zhang authored
      multimedia contains Sound and Video
      3939d052
    • Vincent Pelletier's avatar
      ZSQLCatalog: Add support for query table aliasing. · 7fbbfe44
      Vincent Pelletier authored
      Allows producing SQL for inclusion in ZSQLMethods where catalog table would
      be already aliased.
      7fbbfe44
    • Vincent Pelletier's avatar
      ZSQLCatalog: Move catalog table registration out of ColumnMap. · 071e4b1a
      Vincent Pelletier authored
      registerCatalog method must be avoided whenever possible.
      071e4b1a
    • Vincent Pelletier's avatar
      ZSQLCatalog: Downgrade buildSQLQuery security to public · 058178f1
      Vincent Pelletier authored
      This method only returns caller's input, with catalog schema applied, so
      it does not expose data, so "private" is too restrictive.
      058178f1
    • Vincent Pelletier's avatar
      erp5_banking_check: More *_expression removal · f6935cb8
      Vincent Pelletier authored
      Add dependency on erp5_item to get now-required related keys.
      f6935cb8
  2. 30 Aug, 2017 11 commits
    • Julien Muchembled's avatar
      Automatic ERP5 Site creation · 6bb4c56e
      Julien Muchembled authored
      If the following configuration section is present:
      
      <product-config initsite>
        owner <user-id>
        id <site-id>
        <key> <value>
      </product-config>
      
      the ERP5 product automatically creates a site at startup if there's none.
      This is done by "extending" AppInitializer (OFS.Application).
      
      <key> is any string parameter accepted by manage_addERP5Site, including new
      ones to configure Cloudooo and install bt5. Cloudooo is often required by the
      configurator: apart from that, it does not deserve a field on the addERP5Site
      form.
      
      This deprecates erp5_promise, at least in its current form, for several reasons:
      
      - Since 7fe14b20, alarms aren't run often
        enough.
      
      - For the configuration of external services like memcached, using an alarm or
        anything not instantaneous to update them is wrong because it poses a risk to
        connect to wrong instances. erp5_promise does not handle the catalog because
        it could not and we have another mechanism for that (userhosts), so let's
        handle other services like the catalog.
      
      - The list of bt5 to have installed is only useful at site creation:
        - either (usually) to install configurators, which in turn decide of the list
          to have installed,
        - or a value provided the user, but SlapOS parameters aren't a place to
          duplicate the ERP5 UI.
      
      - With previous commit, the list of bt5 repositories does not depend anymore
        on the location of the software built by SlapOS, and we also don't want to
        duplicate the UI, so the only case where it would remain useful is when the
        list is changed by the software itself, which almost never happens.
        We'll reimplement the promise as a constraint when necessary.
      
      We end up with the minimum functionality to install a configurator
      automatically, and the user does not have to wait anymore for an alarm to be
      triggered.
      
      The default site preference in erp5_core does not come anymore with a default
      value that was specific to SlapOS. It was not enough for our needs and such
      setting should anyway go in a system preference.
      6bb4c56e
    • Julien Muchembled's avatar
      35d8a001
    • Boxiang Sun's avatar
      8ea417c4
    • Boxiang Sun's avatar
      Revert! erp5_officejs_support_request_ui: fix ckeditor gadget url. · 3b515922
      Boxiang Sun authored
      Commit 929ac90a and 0de0acb3 use the text editor from `app.officejs.com`. Which is not same domain as the main application. When Selenium tests run with Firefox. If Firefox visit a page which contains an iframe from another domain, it is unable to redirect to another link and complaints `Permission denied to access property "href"`. In order to make the test get pass on the server with FIrefox. Revert the changes the that two commits which described above.
      3b515922
    • Tristan Cavelier's avatar
      Revert "erp5_officejs_support_request_ui_test: Add test for RSS functionality." · fdf47311
      Tristan Cavelier authored
      This reverts commit 6e58cc8f.
      
      This was freezing some processes on test nodes. I revert during
      bug investigation.
      fdf47311
    • Tristan Cavelier's avatar
      Fix fails to _setEncodedPassword if password is a string · 978ecece
      Tristan Cavelier authored
      In some cases, a Person.password could be a string instead of
      None or PersistentMapping. If string, the code was raising
      TypeError.
      978ecece
    • Vincent Pelletier's avatar
      ZSQLCatalog: Trivial simplification · 6ac0882f
      Vincent Pelletier authored
      6ac0882f
    • Vincent Bechu's avatar
      Revert "fixup erp5 configurator" · f4e1790c
      Vincent Bechu authored
      This reverts commit 9befc11a
      f4e1790c
    • Vincent Bechu's avatar
      fixup erp5 configurator · 9befc11a
      Vincent Bechu authored
      9befc11a
    • Vincent Bechu's avatar
    • Vincent Bechu's avatar
      20cea464
  3. 29 Aug, 2017 4 commits