equal
deleted
inserted
replaced
72 from cubicweb.zmqclient import ZMQRepositoryClient |
72 from cubicweb.zmqclient import ZMQRepositoryClient |
73 return ZMQRepositoryClient(uri) |
73 return ZMQRepositoryClient(uri) |
74 else: |
74 else: |
75 raise ConnectionError('unknown protocol: `%s`' % protocol) |
75 raise ConnectionError('unknown protocol: `%s`' % protocol) |
76 |
76 |
|
77 def connect(repo, login, **kwargs): |
|
78 """Take credential and return associated ClientConnection. |
|
79 |
|
80 The ClientConnection is associated to a new Session object that will be |
|
81 closed when the ClientConnection is closed. |
|
82 |
|
83 raise AuthenticationError if the credential are invalid.""" |
|
84 sessionid = repo.connect(login, **kwargs) |
|
85 session = repo._get_session(sessionid) |
|
86 # XXX the autoclose_session should probably be handle on the session directly |
|
87 # this is something to consider once we have proper server side Connection. |
|
88 return ClientConnection(session, autoclose_session=True) |
|
89 |
77 def _srv_cnx_func(name): |
90 def _srv_cnx_func(name): |
78 """Decorate ClientConnection method blindly forward to Connection |
91 """Decorate ClientConnection method blindly forward to Connection |
79 THIS TRANSITIONAL PURPOSE |
92 THIS TRANSITIONAL PURPOSE |
80 |
93 |
81 will be dropped when we have standalone connection""" |
94 will be dropped when we have standalone connection""" |