1. 27 Mar, 2018 8 commits
    • Tomáš Peterka's avatar
    • Vincent Pelletier's avatar
      ERP5Type: Disallow restricted python from calling immediate reindexation methods · 522da1c2
      Vincent Pelletier authored
      Calling these can break catalog by not caring about concurrent indexation
      activities. Even non-restricted code should not call these, but:
      - they cannot be reliably renamed, as there exist activity dependencies
        looking for these exact names (which is a bad practice on its own)
      - there is no simple access control mechanism for non-restricted code
      So rely on developer discipline instead.
      522da1c2
    • Vincent Pelletier's avatar
      all: Avoid most direct calls to {recursiveI,i}mmediateReindexObject · 35e31f67
      Vincent Pelletier authored
      These methods must not be called synchronously:
      - they can break catalog by not being careful enough about other
        reindexations which may happen in parallel. See the serialization_tag
        mechanism for more.
      - indexation gets executed in the security context of the user causing the
        call, which may lead to an indexation result different from what happens
        when indexation happens with an all-accesses user.
      
      Also, simplify a few scripts while doing so.
      35e31f67
    • Vincent Pelletier's avatar
      ERP5Type: Recursively reindex created documents. · b639160e
      Vincent Pelletier authored
      The rationale behind this change is to cover the case of sub-documents
      modified as part of acquired setters (ex: subordination on Person which
      actually sets it on a Career subdocument, or address on Person, etc).
      As these value can be passed to newContent (and passed on to
      constructInstance) along with immediate reindexation request, caller may
      expect these to be also indexed.
      b639160e
    • Vincent Pelletier's avatar
      ERP5Type,CopySupport: Allow immediately indexing new subobjects · f554c05a
      Vincent Pelletier authored
      "immediate", in this context, means "during the same transaction".
      Normally, indexation always happens in a transaction different from the
      one which did the indexation-inducing action (modifying a property,
      creating a document, explicitely requesting indexation). This is because
      SQL and object databases do not have the same approach to conflict
      resolution: in SQL, the last one wins, and ordering happens based on locks.
      In ZODB, conflict resolution is stricter in that to modify an object
      a transaction must have started with the same revision of that object as
      the one which is current at the time it is trying to commit. As both
      databases must be kept consistent, one interpretation must be enforced
      onto the other: the ZODB interpretation. So delayed indexation, plus
      careful activity sequencing (serialization_tag) is required.
      
      But in very specific cases, it is actually safe to index a document
      immediately: when creating that document. This is because the only
      conflict which may then happen is if two transaction produce the same
      path, and ZODB will prevent the transaction from committing altogether,
      preventing any conflict resolution from happening. Pasting a document
      falls into this category as well, for the same reason.
      
      In turn, this feature removes the need to call "immediate" reindexation
      methods, allowing to restrict their availability later and preventing
      API misuse and catalog consistency compromission.
      
      Two variants of "immediate" indexation are available:
      - internal to the method which creates considered document
      - delayed to a caller-controller, but mandatory, point later in current
        transaction, by using a context (in python sense) manager object.
      f554c05a
    • Vincent Pelletier's avatar
      CopySupport: Add support for reindex_kw. · 35c38086
      Vincent Pelletier authored
      Consistently with other methods which may trigger reindexations.
      35c38086
    • Vincent Pelletier's avatar
      CopySupport: Make is_indexable 3-states. · ba0fd479
      Vincent Pelletier authored
      Consistently with newContent/constructInstance, caller may request one of
      three choices:
      - do not override class choice
      - override class choice, making instance non-indexable
      - override class choice, making instance indexable
      So is_indexable now defaults to None instead of True.
      ba0fd479
    • Vincent Pelletier's avatar
      ERP5Type: Assorted cleanups around indexation methods. · f96752f6
      Vincent Pelletier authored
      Directly bind superclass callable instead when applicable.
      Trivial python simplifications.
      Assorted coding style improvements.
      Drop unhelpful comments and docstrings.
      f96752f6
  2. 26 Mar, 2018 11 commits
    • Romain Courteaud's avatar
      testFunctionalCore: add missing dependency · b6eec549
      Romain Courteaud authored
      erp5_l10n_fa is needed to test the RTL direction.
      b6eec549
    • Romain Courteaud's avatar
    • Romain Courteaud's avatar
      [erp5_xhtml_style] Add right to left language display support · f136eef9
      Romain Courteaud authored
      This is activated only for erp5_l10n_fa by adding the language direction on the body element.
      
      Thanks to Ali Hallaji for the original work.
      f136eef9
    • Vincent Pelletier's avatar
      erp5_discussion: Get a clean original_container acquisition chain · 9e3f2c48
      Vincent Pelletier authored
      Otherwise, aq_chain looks like (note the Temporary Discussion Thread):
      [
       <Discussion Post at /erp5/discussion_thread_module/1/2>,
       <Discussion Thread at /erp5/discussion_thread_module/1>,
       <Discussion Thread Module at /erp5/discussion_thread_module used for /erp5/web_site_module/km_test_web_site/forum/Thread-1-GAJgJcpBPJ>,
       <Temporary Discussion Thread at /erp5/web_site_module/km_test_web_site/forum/Thread-1-GAJgJcpBPJ>,
       <Web Section at /erp5/web_site_module/km_test_web_site/forum>,
       <Web Site at /erp5/web_site_module/km_test_web_site>,
       <Web Site Module at /erp5/web_site_module>,
       <ERP5Site at /erp5>,
       <Application at >,
       <ZPublisher.BaseRequest.RequestContainer object at 0x7f478aa18450>
      ]
      which can confuse a "parent" walk.
      Also, reuse existing code, related to asContext which is just what is
      needed here.
      9e3f2c48
    • Arnaud Fontaine's avatar
      erp5_real_time_inventory_accounting: Move Root Delivery Simulation Rule to... · dc2565f0
      Arnaud Fontaine authored
      erp5_real_time_inventory_accounting: Move Root Delivery Simulation Rule to test bt5 as it is only used in Unit Tests.
      dc2565f0
    • Arnaud Fontaine's avatar
      erp5_real_time_inventory_accounting: Matching on source_section is not enough... · 76e0789c
      Arnaud Fontaine authored
      erp5_real_time_inventory_accounting: Matching on source_section is not enough (Automatic Delivery Accept Solver).
      76e0789c
    • Tristan Cavelier's avatar
      erp5_core: vary module item list cache key according to absolute_url_path · 80fdcbd6
      Tristan Cavelier authored
      The getModuleItemList function should not cache absolute_url_path as it
      may vary according to where the script is called from. Here we generate
      the cache key to also vary according to the same condition as the module
      absolute_url_path results.
      
      _portal_url_  _________called_from_url_________ -> __portal_url_VirtualRootPhysicalPath___  ________module.absolute_url_path_______  _result_
      /erp5         /erp5/...                            /erp5                                    /erp5/my_module                          OK
      /erp5         /erp5/web_site_module/my_site/...    /erp5                                    /erp5/web_site_module/my_site/my_module  BAD
      /erp5/        /erp5/web_site_module/my_site/...    /erp5/web_site_module/my_site            /erp5/web_site_module/my_site/my_module  OK
      80fdcbd6
    • Boxiang Sun's avatar
      CMFActivity: Use a random value for activity uids · e1549361
      Boxiang Sun authored
      Sequential number generators stored in a fixed-size format eventually run
      out of values. But activity queues only care about what activities are
      currently present: any uid can be reused as soon as it is available.
      So stop using a sequential id generator for activity uids, and instead use
      random values.
      
      Vincent Pelletier:
      - Commit message.
      - Minor formatting changes.
      - Do probability computations, and increase activity uid storage size to
        64bits integers, up from 32. Table schema migration happens on first
        activity node which starts on upgraded code.
      - Apply to SQLJobLib too.
      e1549361
    • Vincent Pelletier's avatar
      CMFActivity: Stop deleting duplicates during SQLDict.distribute · d0472bc2
      Vincent Pelletier authored
      Duplicate message detection is not good enough: different messages with
      the same unicity value may bear different serialization_tags. This code
      does not takes this into account, which can lead to deleting such tagged
      message and validate an untagged one, which breaks serialization_tag
      contract of preventing any further activity validation until execution
      of all such-tagged validated activities is successful.
      Also, it is not validation's node job to deduplicate: it can happen during
      message execution without slowing down this crucial (performance-wise)
      activity node.
      As a result, distribute methods of SQLDict and SQLQueue can be factorised.
      d0472bc2
    • Vincent Pelletier's avatar
      EPR5Type: Drop unused import. · 3f26e402
      Vincent Pelletier authored
      3f26e402
    • Vincent Pelletier's avatar
  3. 23 Mar, 2018 1 commit
  4. 22 Mar, 2018 1 commit
  5. 21 Mar, 2018 4 commits
  6. 20 Mar, 2018 15 commits