From 972d9f1e977fbceebbbb2495df639d43b36c2ff6 Mon Sep 17 00:00:00 2001 From: Christophe Dumez <christophe@nexedi.com> Date: Wed, 22 Mar 2006 15:58:34 +0000 Subject: [PATCH] - fixed checkin, it is working now. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6181 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Subversion/SubversionClient.py | 24 +++++++++--- product/ERP5Subversion/Tool/SubversionTool.py | 39 ++++++++++--------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/product/ERP5Subversion/SubversionClient.py b/product/ERP5Subversion/SubversionClient.py index 0d3d59f5c7..5f3aed6829 100755 --- a/product/ERP5Subversion/SubversionClient.py +++ b/product/ERP5Subversion/SubversionClient.py @@ -27,6 +27,7 @@ ############################################################################## from Acquisition import Implicit + import time from Products.ERP5Type.Utils import convertToUpperCase from MethodObject import Method @@ -180,9 +181,11 @@ try: self.client.set_auth_cache(0) self.client.callback_cancel = CancelCallback(self) self.client.callback_get_log_message = GetLogMessageCallback(self) - self.client.callback_get_login = GetLoginCallback(self) + #self.client.callback_get_login = GetLoginCallback(self) + self.client.callback_get_login = self.callback_get_Login self.client.callback_notify = NotifyCallback(self) - self.client.callback_ssl_server_trust_prompt = SSLServerTrustPromptCallback(self) + #self.client.callback_ssl_server_trust_prompt = SSLServerTrustPromptCallback(self) + self.client.callback_ssl_server_trust_prompt = self.callback_ssl_server_trust_prompt self.creation_time = time.time() self.__dict__.update(kw) @@ -192,12 +195,23 @@ try: def getTimeout(self): return self.timeout - def getLogin(self, realm): - return self.aq_parent._getLogin(realm) - + def callback_get_Login( self, realm, username, may_save ): + #Retrieving saved username/password + #raise 'realm is '+realm+' && username is '+username + username, password = self.login + if not username : + raise "Error: Couldn't retrieve saved username !" + if not password : + raise "Error: Couldn't retrieve saved password !" + return 1, username, password, True + def trustSSLServer(self, trust_dict): return self.aq_parent._trustSSLServer(trust_dict) + def callback_ssl_server_trust_prompt( self, trust_data ): + # Always trusting + return True, trust_data['failures'], True + def checkin(self, path, log_message, recurse): return self.client.checkin(path, log_message=log_message, recurse=recurse) diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py index f207e9f35e..be7cdcc475 100755 --- a/product/ERP5Subversion/Tool/SubversionTool.py +++ b/product/ERP5Subversion/Tool/SubversionTool.py @@ -148,23 +148,26 @@ class SubversionTool(UniqueObject, Folder): # Decode login information. return loads(b64decode(login)) - def setLogin(self, realm, user, password): - """Set login information. - """ - # Get existing login information. Filter out old information. - login_list = [] - request = self.REQUEST - cookie = request.get(self.login_cookie_name) - if cookie: - for login in cookie.split(','): - if self._decodeLogin(login)[0] != realm: - login_list.append(login) - # Set the cookie. - response = request.RESPONSE - login_list.append(self._encodeLogin(realm, user, password)) - value = ','.join(login_list) - expires = (DateTime() + 1).toZone('GMT').rfc822() - response.setCookie(self.login_cookie_name, value, path = '/', expires = expires) +# def setLogin(self, realm, user, password): +# """Set login information. +# """ +# # Get existing login information. Filter out old information. +# login_list = [] +# request = self.REQUEST +# cookie = request.get(self.login_cookie_name) +# if cookie: +# for login in cookie.split(','): +# if self._decodeLogin(login)[0] != realm: +# login_list.append(login) +# # Set the cookie. +# response = request.RESPONSE +# login_list.append(self._encodeLogin(realm, user, password)) +# value = ','.join(login_list) +# expires = (DateTime() + 1).toZone('GMT').rfc822() +# response.setCookie(self.login_cookie_name, value, path = '/', expires = expires) + + def setLogin(self, username, passwd): + self.login = (username, passwd) def _getLogin(self, target_realm): request = self.REQUEST @@ -268,7 +271,7 @@ class SubversionTool(UniqueObject, Folder): def checkin(self, path, log_message = 'None', recurse=True): """Commit local changes. """ - client = self._getClient() + client = self._getClient(login=self.login) #return client.checkin(self._getWorkingPath(path), log_message, recurse) return client.checkin(path, log_message, recurse) -- 2.30.9