cubicweb/web/views/authentication.py
changeset 12567 26744ad37953
parent 12279 e2953e0de494
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """user authentication component"""
    18 """user authentication component"""
    19 
       
    20 from six import text_type
       
    21 
    19 
    22 from logilab.common.deprecation import class_renamed
    20 from logilab.common.deprecation import class_renamed
    23 from logilab.common.textutils import unormalize
    21 from logilab.common.textutils import unormalize
    24 
    22 
    25 from cubicweb import AuthenticationError
    23 from cubicweb import AuthenticationError
   112         self.user = user  # XXX deprecate and store only a login.
   110         self.user = user  # XXX deprecate and store only a login.
   113         self.repo = repo
   111         self.repo = repo
   114         self.sessionid = make_uid(unormalize(user.login))
   112         self.sessionid = make_uid(unormalize(user.login))
   115         self.data = {}
   113         self.data = {}
   116 
   114 
   117     def __unicode__(self):
   115     def __str__(self):
   118         return '<session %s (0x%x)>' % (text_type(self.user.login), id(self))
   116         return '<session %s (0x%x)>' % (self.user.login, id(self))
   119 
   117 
   120     @property
   118     @property
   121     def anonymous_session(self):
   119     def anonymous_session(self):
   122         # XXX for now, anonymous_user only exists in webconfig (and testconfig).
   120         # XXX for now, anonymous_user only exists in webconfig (and testconfig).
   123         # It will only be present inside all-in-one instance.
   121         # It will only be present inside all-in-one instance.