cubicweb/repoapi.py
changeset 11195 5de859b95988
parent 11057 0b59724cb3f2
child 12032 c16c1805e973
equal deleted inserted replaced
11194:b6b00bb1e528 11195:5de859b95988
    45 
    45 
    46 def connect(repo, login, **kwargs):
    46 def connect(repo, login, **kwargs):
    47     """Take credential and return associated Connection.
    47     """Take credential and return associated Connection.
    48 
    48 
    49     raise AuthenticationError if the credential are invalid."""
    49     raise AuthenticationError if the credential are invalid."""
    50     sessionid = repo.connect(login, **kwargs)
    50     return repo.new_session(login, **kwargs).new_cnx()
    51     session = repo._get_session(sessionid)
       
    52     # XXX the autoclose_session should probably be handle on the session directly
       
    53     # this is something to consider once we have proper server side Connection.
       
    54     return Connection(session)
       
    55 
    51 
    56 def anonymous_cnx(repo):
    52 def anonymous_cnx(repo):
    57     """return a Connection for Anonymous user.
    53     """return a Connection for Anonymous user.
    58 
    54 
    59     raises an AuthenticationError if anonymous usage is not allowed
    55     raises an AuthenticationError if anonymous usage is not allowed