server/hook.py
changeset 2855 1d9be3dffa94
parent 2847 c2ee28f4d4b1
child 2968 0e3460341023
--- a/server/hook.py	Fri Aug 14 14:31:25 2009 +0200
+++ b/server/hook.py	Fri Aug 14 15:53:12 2009 +0200
@@ -39,6 +39,7 @@
 from logging import getLogger
 
 from logilab.common.decorators import classproperty
+from logilab.common.deprecation import deprecated
 from logilab.common.logging_ext import set_log_methods
 
 from cubicweb.cwvreg import CWRegistry, VRegistry
@@ -131,7 +132,7 @@
     events = None
     category = None
     order = 0
-    # XXX deprecates
+    # XXX deprecated
     enabled = True
 
     @classproperty
@@ -214,12 +215,6 @@
 
     def __init__(self, session, **kwargs):
         self.session = session
-        # XXX deprecates
-        self.user = session.user
-        self.repo = session.repo
-        self.schema = session.repo.schema
-        self.config = session.repo.config
-        # end deprecate
         self.__dict__.update(kwargs)
         self.register(session)
         # execution information
@@ -269,6 +264,26 @@
         operation list
         """
 
+    @property
+    @deprecated('[3.5] use self.session.user')
+    def user(self):
+        return self.session.user
+
+    @property
+    @deprecated('[3.5] use self.session.repo')
+    def repo(self):
+        return self.session.repo
+
+    @property
+    @deprecated('[3.5] use self.session.vreg.schema')
+    def schema(self):
+        return self.session.repo.schema
+
+    @property
+    @deprecated('[3.5] use self.session.vreg.config')
+    def config(self):
+        return self.session.repo.config
+
 set_log_methods(Operation, getLogger('cubicweb.session'))