still more explicit registration tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 17 Feb 2009 17:25:59 +0100
branchtls-sprint
changeset 671 4ae56cfd530d
parent 670 6c332f5c969c
child 672 bfd01026ada8
still more explicit registration
goa/appobjects/gauthservice.py
--- a/goa/appobjects/gauthservice.py	Tue Feb 17 17:13:55 2009 +0100
+++ b/goa/appobjects/gauthservice.py	Tue Feb 17 17:25:59 2009 +0100
@@ -1,29 +1,18 @@
 """authentication using google authentication service
 
 :organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
 
-from cubicweb.common.registerers import priority_registerer
 from cubicweb.web.views.basecomponents import UserLink
 from cubicweb.web.views.actions import LogoutAction
 
 from google.appengine.api import users
 
 
-class use_google_auth_registerer(priority_registerer):
-    """register object if use-google-auth is true"""
-    
-    def do_it_yourself(self, registered):
-        if not hasattr(self.config, 'has_resource'):
-            return
-        return super(use_google_auth_registerer, self).do_it_yourself(registered)
-
-
 class GAEUserLink(UserLink):
-    __registerer__ = use_google_auth_registerer
 
     def anon_user_link(self):
         self.w(self.req._('anonymous'))
@@ -31,7 +20,11 @@
                % (users.create_login_url(self.req.url()), self.req._('login')))
 
 class GAELogoutAction(LogoutAction):
-    __registerer__ = use_google_auth_registerer
 
     def url(self):
         return users.create_logout_url(self.req.build_url('logout') )
+    
+def registration_callback(vreg):
+    if hasattr(vreg.config, 'has_resource'):
+        vreg.register(GAEUserLink, clear=True)
+        vreg.register(GAELogoutAction, clear=True)