--- a/goa/appobjects/gauthservice.py Tue Feb 17 17:30:47 2009 +0100
+++ b/goa/appobjects/gauthservice.py Tue Feb 17 17:31:16 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)
--- a/server/hooksmanager.py Tue Feb 17 17:30:47 2009 +0100
+++ b/server/hooksmanager.py Tue Feb 17 17:31:16 2009 +0100
@@ -23,7 +23,7 @@
:organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
@@ -182,7 +182,7 @@
from cubicweb.vregistry import autoselectors
from cubicweb.common.appobject import AppObject
-from cubicweb.common.registerers import accepts_registerer, yes_registerer
+from cubicweb.common.registerers import yes_registerer
from cubicweb.common.selectors import yes
class autoid(autoselectors):
@@ -195,7 +195,7 @@
class Hook(AppObject):
__metaclass__ = autoid
__registry__ = 'hooks'
- __registerer__ = accepts_registerer
+ __registerer__ = yes_registerer
__selectors__ = (yes,)
# set this in derivated classes
events = None
@@ -245,7 +245,6 @@
raise NotImplementedError
class SystemHook(Hook):
- __registerer__ = yes_registerer
accepts = ('',)
from logging import getLogger
--- a/vregistry.py Tue Feb 17 17:30:47 2009 +0100
+++ b/vregistry.py Tue Feb 17 17:31:16 2009 +0100
@@ -289,13 +289,16 @@
break
def register_and_replace(self, obj, replaced, registryname=None):
+ if hasattr(replaced, 'classid'):
+ replaced = replaced.classid()
registryname = registryname or obj.__registry__
registry = self.registry(registryname)
registered_objs = registry[obj.id]
for index, registered in enumerate(registered_objs):
if registered.classid() == replaced:
- registry[obj.id][index] = obj
- self._registered['%s.%s' % (obj.__module__, obj.id)] = obj
+ del registry[obj.id][index]
+ break
+ self.register(obj, registryname=registryname)
# dynamic selection methods ###############################################