1. 25 Apr, 2018 1 commit
    • Laurent Wouters's avatar
      [utils] Fixes compatiblity of QueryCache with expected dict interface · cbbcfa69a0e7
      Laurent Wouters authored
      QueryCache is expected to mimick the interface of the dict built-in. The current
      __iter__ implementation breaks this expectation by iterating over key, value
      pairs instead of only the keys.
      
      This changeset fixes this issue by changing the __iter__ implementation to
      iterate over the keys in the cache and providing an implementation of the items
      method with a contract identical to the dict build-in (return a copy of the key-
      value pairs within the dictionary as a list).
      cbbcfa69a0e7
  2. 24 Apr, 2018 5 commits
    • David Douard's avatar
      d507cbe169ab
    • Laurent Wouters's avatar
      [utils] Implements __iter__ on QueryCache · c96dd92e480e
      Laurent Wouters authored
      In order to be able to iterate over the currently cached queries (so that they
      may be inspected and invalidated), this changeset implementes __iter__ on
      QueryCache.
      c96dd92e480e
    • Laurent Wouters's avatar
      [utils] Added new get method to QueryCache · 9fd7d496e27e
      Laurent Wouters authored
      The new get method enables the retrieval an item in the cache by specifying a
      default value so that in the absence of an item for the key, the default value
      is returned.
      9fd7d496e27e
    • David Douard's avatar
      [test/rset] typo · c1538e5ac532
      David Douard authored
      c1538e5ac532
    • Laurent Wouters's avatar
      [utils] Fixed issue in clearing QueryCache · 198cb7d7b4ac
      Laurent Wouters authored
      When trying to add an item in a full QueryCache, the cache tries to make room.
      It tries to list and remove non-permanent items with a transient counter (number
       of times it has been requested). However, there is a pathological case where
      items could be non-permanent but still not have a transient counter because they
      were added, but never requested. In some cases, the full cache could be flushed,
       including the permanent items.
      This changeset attempts to fix this issue by only dropping the non-permanent
      items that did not hav a transient counter.
      198cb7d7b4ac
  3. 13 Nov, 2017 1 commit
    • David Douard's avatar
      [statsd] add a statsd_timethis context manager · 0d474f888f4a
      David Douard authored
      This context manager allows to report to statsd the execution time of any
      piece of code, without the need for it to be a function or a method, like::
      
        def some_function():
          do_stuff()
          with statsd_timethis('some context message'):
            do_that()
            ensure_this()
      0d474f888f4a
  4. 24 Apr, 2018 3 commits
  5. 21 Sep, 2017 1 commit
  6. 24 Apr, 2018 1 commit
    • Laurent Wouters's avatar
      [server] Fixed issue with the adapters cache of a cloned EditedEntity · 38058ce2a9ec
      Laurent Wouters authored
      The adapters' cache of the entity within an EditedEntity used to be copied along
      the entity itself during a cloning operation of the EditedEntity. This raises
      an issue when the adapters' cache is not empty and contains cached values
      linking to transaction-specific data (or the transaction itself). This prevents
      the clone EditedEntity being used in a transaction outside the one that created
      it.
      
      This change resets the adapters' cache of the new copy so that no cached value
      remain. The new copy can then be used in a new transaction afterwards.
      38058ce2a9ec
  7. 23 Apr, 2018 4 commits
  8. 12 Jan, 2018 1 commit
    • Denis Laxalde's avatar
      [schema] Define a decorator to handle methods override · 46a8146f9703
      Denis Laxalde authored
      There is a number of external classes (from yams/rql) methods overridden
      "by hand" in cubicweb/schema.py. Define a single decorator to factor out
      the pattern. It handles specifying the method name (to avoid conflict
      with the local namespace) and passing the original method to the new
      definition when needed.
      46a8146f9703
  9. 24 Jan, 2018 9 commits
  10. 12 Jan, 2018 3 commits
  11. 12 Dec, 2017 1 commit
    • Denis Laxalde's avatar
      [pyramid] Let logging be configured through .ini file · cd760c411242
      Denis Laxalde authored
      We do not initialize logging in CubicWebPyramidConfiguration thus
      preventing logging to be started with cubicweb's configuration. On the
      other hand, any logging configuration defined in ``development.ini``
      file will be loaded by whatever start the instance using this file (i.e.
      pserve, gunicorn, etc.). The benefit is that logging can now be
      configured per "qualified name" in this file (i.e. one can easily set
      the DEBUG level for the application cube while keeping all dependencies'
      level to WARNING). In the development.ini template, we add logger
      configurations for "logilab" and "cubicweb" qualified names (along with
      those of the application cube).
      cd760c411242
  12. 01 Dec, 2017 2 commits
    • Denis Laxalde's avatar
      Disable pytest's logs reporting · 6a71cb23f827
      Denis Laxalde authored
      CubicWeb already prints captured logs in stderr upon test failure, so we
      get them twice. Until we fix our logging management, disabling pytest
      capture and restore brings the output level back to sanity.
      6a71cb23f827
    • Denis Laxalde's avatar
      [pyramid] Do not issue security warnings in test mode · a46fb3f58ea2
      Denis Laxalde authored
      When some session or authtk secret is missing in Pyramid settings,
      scary "!! SECURITY WARNING !!" are issued. This is arguably pointless in
      tests. So disable them in this case.
      a46fb3f58ea2
  13. 30 Nov, 2017 3 commits
    • Denis Laxalde's avatar
      [ssplanner] Prevent execution of write queries involving computed relations · 68ca7fe0ca29
      Denis Laxalde authored
      Previously, setting a computed relation upon entity creation or
      modification (using the ORM or an RQL query) would usually fail with an
      operational error in the backend ("no such table"). However, under some
      mysterious circumstances (like passing a string as value in cw_set for a
      computed relation), the RQL to SQL transformation would simply drop the
      clause.
      
      To prevent this to happen, we add a check for computed relation before
      adding a relation to an execution plan. This check raises a QueryError.
      It happens in several places:
      
      * in querier.InsertPlan.add_relation_def() (called from several places
        in ssplanner steps) for INSERT queries,
      * in ssplanner.UpdateStep.execute() for SET queries and,
      * in ssplanner.SSplanner.build_delete_plan() for DELETE queries.
      
      Tests added to unittest_querier.py because unittest_sslplanner.py looked
      inappropriate (it has only unit tests) and the former already had a
      NonRegressionTC class.
      68ca7fe0ca29
    • Denis Laxalde's avatar
      [querier] Expand 'rdef' argument in InsertPlan.add_relation_def() · 06deb43c23c3
      Denis Laxalde authored
      Expand the 'rdef' tuple to improve readability. The 'rtype' value is not
      used at the moment, but will in the next changeset.
      06deb43c23c3
    • Denis Laxalde's avatar
  14. 03 Nov, 2017 4 commits
  15. 30 Oct, 2017 1 commit