1. 15 Nov, 2019 2 commits
    • Jérome Perrin's avatar
      preferences: clear cache in a more clever way · b55661f3
      Jérome Perrin authored
      Introduce something similar to "cache cookie", but more suitable for
      preferences that depend both on the site configuration and user
      preferences.
      
      We store for each user a value in _preference_cache and we modify this
      value each time user change his user preference. This value is then
      used part of the a cache key.
      The same mechanism happen with a global value for site and group
      preferences. See _getCacheId docstring for more details.
      
      This way, when one user modify their preference this does not reset
      cache for every user.
      
      Because we have proper invalidation, increase the case duration by using
      erp5_ui_short instead of erp5_ui_long
      
      This is applied to both preference methods and to templates documents
      inside preferences.
      
      test_system_preference_value_prefererred_clear_cache_disabled is updated
      to use another preference name, because it was same as in a previous
      test, so that we don't have test isolation problems.
      b55661f3
    • Jérome Perrin's avatar
      preferences: use an interaction workflow to clear cache · 3e558ff9
      Jérome Perrin authored
      When we use preference.edit(preferred_something=something_else) the
      cache was cleared, because there is an interaction on _edit, but when we
      do preference.setPreferredSomething(something_else) cache was not
      cleared.
      
      This still have a problem cache is cleared too much but at least it
      eliminates this incorrect behavior.
      
      Update tests at the same time:
       - testEditorField,testAuthenticationPolicy: no need to clear cache,
         it's now done automatically.
       - testUpgrader: the workflow chain of preference changed. This test is
         asserting the actual workflow chain, so we have to update the test
         everytime workflow chain is modified.
      3e558ff9
  2. 14 Nov, 2019 6 commits
  3. 13 Nov, 2019 2 commits
  4. 12 Nov, 2019 3 commits
    • Jérome Perrin's avatar
      fixup! pdm: introduce a asCellRange script for Measure · 08bf6d94
      Jérome Perrin authored
      from a41f71c3 :
      > Remove the TALES for lines, columns and tab on the matrix box because
      > the default behavior is to call this updateCellRange script
      
      that's not true, we have to list the asCellRange script explicitly.
      08bf6d94
    • Arnaud Fontaine's avatar
      ZODB Components: ModuleSecurityInfo() should also apply to the alias module,... · eabcb211
      Arnaud Fontaine authored
      ZODB Components: ModuleSecurityInfo() should also apply to the alias module, not only to the versioned one.
      
      This fixes an Unauthorized error when GitLoginError is imported from
      erp5.component.module.Git defining ModuleSecurityInfo() for __name__
      (erp5.component.module.erp5_version.Git).
      
      Note that when migrating the content of a Product, ModuleSecurityInfo() first
      parameter must be __name__.
      
      Traceback (innermost last):
        [...]
        Module script, line 1, in BusinessTemplate_handleException
         - <PythonScript at /erp5/BusinessTemplate_handleException used for /erp5/portal_templates/832>
         - Line 1
          from erp5.component.module.Git import GitLoginError
        Module Products.ERP5Type.patches.Restricted, line 305, in guarded_import
          return orig_guarded_import(mname, globals, locals, fromlist, level)
        Module AccessControl.ZopeGuards, line 305, in guarded_import
          raise Unauthorized("import of '%s' is unauthorized" % mname)
      Unauthorized: import of 'erp5.component.module.Git' is unauthorized
      eabcb211
    • Arnaud Fontaine's avatar
      ZODB Components: Alias module was not added to sys.modules if the module it... · 223d4818
      Arnaud Fontaine authored
      ZODB Components: Alias module was not added to sys.modules if the module it points to had already been loaded before.
      223d4818
  5. 11 Nov, 2019 1 commit
  6. 08 Nov, 2019 6 commits
    • Roque's avatar
      erp5_forge: bug module domain · 40b23070
      Roque authored
      40b23070
    • Roque's avatar
      erp5_crm: new domain in support request list · 93df28d7
      Roque authored
      93df28d7
    • Roque's avatar
      erp5_base: common script to generate domains · b381ef8f
      Roque authored
      b381ef8f
    • Roque's avatar
    • Roque's avatar
      erp5_web_project_ui: initial commit for project.nexedi.net · 86b1843b
      Roque authored
      - new skin folder with project quick view form, scripts and gadgets
      - front page redirects to custom project module
      86b1843b
    • Jérome Perrin's avatar
      patches/pylint: fix regression with namedtuples · 5027502c
      Jérome Perrin authored
      with namedtuples and unicode literals enabled, our patch break with:
      
          Module py2stdlib, line 266, in infer_named_tuple
            ''' % {'name': name, 'fields': attributes})
          Module Products.ERP5Type.patches.pylint, line 74, in string_build
            encoding = _guess_encoding(data)
          Module astroid.builder, line 65, in _guess_encoding
            if string.startswith('\xef\xbb\xbf'):
          UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
      
      because pylint/astroid uses string_build to evaluate the named tuple and the source code enabled 
      unicode_literals future, string_build is called with an unicode object.
      
          -> for inferred in node.func.infer():
            astroid-1.3.8-py2.7.egg/astroid/bases.py(391)infer()
          -> return self._explicit_inference(self, context, **kwargs)
            astroid-1.3.8-py2.7.egg/astroid/brain/py2stdlib.py(266)infer_named_tuple()
          -> ''' % {'name': name, 'fields': attributes})
          > erp5/product/ERP5Type/patches/pylint.py(77)string_build()
          -> data = data.encode('utf-8')
          (Pdb) up
          > astroid-1.3.8-py2.7.egg/astroid/brain/py2stdlib.py(266)infer_named_tuple()
          -> ''' % {'name': name, 'fields': attributes})
          (Pdb) l
          249     def infer_named_tuple(node, context=None):
          250         """Specific inference function for namedtuple CallFunc node"""
          251         class_node, name, attributes = infer_func_form(node, nodes.Tuple._proxied,
          252                                                        context=context)
          253         fake = AstroidBuilder(MANAGER).string_build('''
          254     class %(name)s(tuple):
          255         _fields = %(fields)r
          256         def _asdict(self):
          257             return self.__dict__
          258         @classmethod
          259         def _make(cls, iterable, new=tuple.__new__, len=len):
          260             return new(cls, iterable)
          261         def _replace(_self, **kwds):
          262             result = _self._make(map(kwds.pop, %(fields)r, _self))
          263             if kwds:
          264                 raise ValueError('Got unexpected field names: %%r' %% list(kwds))
          265             return result
          266  ->     ''' % {'name': name, 'fields': attributes})
          (Pdb) pp name
          u'NamedTuple'
          (Pdb) pp attributes
          [u'foo', u'bar']
          (Pdb) pp [ (arg, arg.value) for arg in node.args ]
          [(<Const(unicode) l.4 [checkPythonSourceCodelXOzr3] at 0x7f9f1caee250>,
            u'NamedTuple'),
           (<Const(unicode) l.4 [checkPythonSourceCodelXOzr3] at 0x7f9f1caeebd0>,
            u'foo bar')]
          
          
      
      /reviewed-on !978
      5027502c
  7. 07 Nov, 2019 7 commits
  8. 06 Nov, 2019 3 commits
  9. 05 Nov, 2019 1 commit
  10. 31 Oct, 2019 9 commits