[PATCH 1 of 5 saem] Migrate to cw 3.25

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Oct 6 17:03:54 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1507217924 -7200
#      Thu Oct 05 17:38:44 2017 +0200
# Node ID 534a551a40df5a4d1f117937ed10b1fcda59bbad
# Parent  4c894c0585d354cebbf598bc5cd1c6d67aee143e
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 534a551a40df
Migrate to cw 3.25

and drop monkey-patches which are hence no more necessary.

Depends on unreleased version of cubicweb-seda since 3.25 incompatibility lies
there.

Closes #17106818

diff --git a/cubicweb_saem_ref/__pkginfo__.py b/cubicweb_saem_ref/__pkginfo__.py
--- a/cubicweb_saem_ref/__pkginfo__.py
+++ b/cubicweb_saem_ref/__pkginfo__.py
@@ -13,11 +13,11 @@ author = 'LOGILAB S.A. (Paris, FRANCE)'
 author_email = 'contact at logilab.fr'
 description = "Référenciel de Système d'Archivage Électronique Mutualisé"
 web = 'http://www.cubicweb.org/project/%s' % distname
 
 __depends__ = {
-    'cubicweb[pyramid]': '>= 3.24.0, < 3.25.0',
+    'cubicweb[pyramid]': '>= 3.25.0, < 3.26.0',
     'cubicweb-squareui': None,
     'cubicweb-eac': '>= 0.5.0, < 0.6.0',
     'cubicweb-seda': '>= 0.10.0, < 0.11.0',
     'cubicweb-compound': '>= 0.6.0, < 0.7.0',
     'cubicweb-prov': '>= 0.4.0, < 0.5.0',
diff --git a/cubicweb_saem_ref/site_cubicweb.py b/cubicweb_saem_ref/site_cubicweb.py
--- a/cubicweb_saem_ref/site_cubicweb.py
+++ b/cubicweb_saem_ref/site_cubicweb.py
@@ -174,53 +174,10 @@ def negotiated_language(self):
 
 ####################################################################################################
 # temporary monkey-patches #########################################################################
 ####################################################################################################
 
-# proper behaviour of hooks control cm (https://www.cubicweb.org/ticket/17049333)
-
-from cubicweb.server import session  # noqa
-
-
- at monkeypatch(session)
-class _hooks_control(object):
-    def __init__(self, cnx, mode, *categories):
-        assert mode in (session.HOOKS_ALLOW_ALL, session.HOOKS_DENY_ALL)
-        self.cnx = cnx
-        self.mode = mode
-        self.categories = set(categories)
-        self.old_mode = None
-        self.old_categories = None
-
-    def __enter__(self):
-        self.old_mode = self.cnx._hooks_mode
-        self.old_categories = self.cnx._hooks_categories
-        self.cnx._hooks_mode = self.mode
-        self.cnx._hooks_categories = self.categories
-
-    def __exit__(self, exctype, exc, traceback):
-        self.cnx._hooks_mode = self.old_mode
-        self.cnx._hooks_categories = self.old_categories
-
-
-orig_connection_init = session.Connection.__init__
-
-
- at monkeypatch(session.Connection)
-def __init__(self, *args, **kwargs):
-    orig_connection_init(self, *args, **kwargs)
-    self._hooks_mode = session.HOOKS_ALLOW_ALL
-    self._hooks_categories = set()
-
-
- at monkeypatch(session.Connection)
-def is_hook_category_activated(self, category):
-    if self._hooks_mode is session.HOOKS_DENY_ALL:
-        return category in self._hooks_categories
-    return category not in self._hooks_categories
-
-
 # avoid disappearance of navtop components (https://www.cubicweb.org/17074195)
 # other part lies in views/patches.py
 
 from cubicweb.utils import json_dumps, js_href  # noqa
 from cubicweb.web import component  # noqa
diff --git a/dev-requirements.txt b/dev-requirements.txt
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,3 +1,4 @@
 mock
 pytest
 webtest
+http://hg.logilab.org/review/cubes/seda/archive/tip.tar.bz2#egg=cubicweb-seda


More information about the saem-devel mailing list