Fix _login to pass arguments to the server unconditionally, rather than

requiring precisely two on the client-side.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
Ewan Mellor committed 2006-12-18 00:14:40 +00:00
1 parent 6d6cd40676
commit 75bbf9d488
1 file changed
+4 -4
+4 -4
View File
@@ -84,23 +84,23 @@ class Session(xen.util.xmlrpclib2.ServerProxy):
def xenapi_request(self, methodname, params):
if methodname.startswith('login'):
self._login(methodname, *params)
self._login(methodname, params)
return None
else:
full_params = (self._session,) + params
return _parse_result(getattr(self, methodname)(*full_params))
def _login(self, method, username, password):
def _login(self, method, params):
self._session = _parse_result(
getattr(self, 'session.%s' % method)(username, password))
getattr(self, 'session.%s' % method)(*params))
def __getattr__(self, name):
if name == 'xenapi':
return _Dispatcher(self.xenapi_request, None)
elif name.startswith('login'):
return lambda u, p: self._login(name, u, p)
return lambda *params: self._login(name, params)
else:
return xen.util.xmlrpclib2.ServerProxy.__getattr__(self, name)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.