# HG changeset patch # User Pierre-Yves David # Date 1371809286 -7200 # Node ID 795ea498225f5d52598968bd31a87084d321f6dc # Parent 2f45e99ad753c2a647a06d176169a9a65bd8f650 [cwuser] make CWUser callable, returning self for dbapi compatibility In the dbapi, Connection and Session have a ``user`` method to generated a user for a request In the repo api, Connection and Session have a user attribute inherited from SessionRequestBase prototype. This ugly hack allows to not break user of the user method. To ease transition from dbapi to repoapi we need the ClientConnection to be as compatible as possible with the dbapi. Adding this method goes in this direction. It'll get deprecated in the deprecation wave that will conclude the repoapi refactoring. related to #2503918 diff -r 2f45e99ad753 -r 795ea498225f entities/authobjs.py --- a/entities/authobjs.py Fri Jun 21 15:26:03 2013 +0200 +++ b/entities/authobjs.py Fri Jun 21 12:08:06 2013 +0200 @@ -166,6 +166,17 @@ dc_long_title = name + def __call__(self, *args, **kwargs): + """ugly hack for compatibility betweeb dbapi and repo api + + In the dbapi, Connection and Session have a ``user`` method to + generated a user for a request In the repo api, Connection and Session + have a user attribute inherited from SessionRequestBase prototype. This + ugly hack allows to not break user of the user method. + + XXX Deprecate me ASAP""" + return self + from logilab.common.deprecation import class_renamed EUser = class_renamed('EUser', CWUser) EGroup = class_renamed('EGroup', CWGroup)