Commit 972d9f1e authored by Christophe Dumez's avatar Christophe Dumez

- fixed checkin, it is working now.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6181 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent baf98a26
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Acquisition import Implicit from Acquisition import Implicit
import time import time
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from MethodObject import Method from MethodObject import Method
...@@ -180,9 +181,11 @@ try: ...@@ -180,9 +181,11 @@ try:
self.client.set_auth_cache(0) self.client.set_auth_cache(0)
self.client.callback_cancel = CancelCallback(self) self.client.callback_cancel = CancelCallback(self)
self.client.callback_get_log_message = GetLogMessageCallback(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_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.creation_time = time.time()
self.__dict__.update(kw) self.__dict__.update(kw)
...@@ -192,12 +195,23 @@ try: ...@@ -192,12 +195,23 @@ try:
def getTimeout(self): def getTimeout(self):
return self.timeout return self.timeout
def getLogin(self, realm): def callback_get_Login( self, realm, username, may_save ):
return self.aq_parent._getLogin(realm) #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): def trustSSLServer(self, trust_dict):
return self.aq_parent._trustSSLServer(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): def checkin(self, path, log_message, recurse):
return self.client.checkin(path, log_message=log_message, recurse=recurse) return self.client.checkin(path, log_message=log_message, recurse=recurse)
......
...@@ -148,23 +148,26 @@ class SubversionTool(UniqueObject, Folder): ...@@ -148,23 +148,26 @@ class SubversionTool(UniqueObject, Folder):
# Decode login information. # Decode login information.
return loads(b64decode(login)) return loads(b64decode(login))
def setLogin(self, realm, user, password): # def setLogin(self, realm, user, password):
"""Set login information. # """Set login information.
""" # """
# Get existing login information. Filter out old information. # # Get existing login information. Filter out old information.
login_list = [] # login_list = []
request = self.REQUEST # request = self.REQUEST
cookie = request.get(self.login_cookie_name) # cookie = request.get(self.login_cookie_name)
if cookie: # if cookie:
for login in cookie.split(','): # for login in cookie.split(','):
if self._decodeLogin(login)[0] != realm: # if self._decodeLogin(login)[0] != realm:
login_list.append(login) # login_list.append(login)
# Set the cookie. # # Set the cookie.
response = request.RESPONSE # response = request.RESPONSE
login_list.append(self._encodeLogin(realm, user, password)) # login_list.append(self._encodeLogin(realm, user, password))
value = ','.join(login_list) # value = ','.join(login_list)
expires = (DateTime() + 1).toZone('GMT').rfc822() # expires = (DateTime() + 1).toZone('GMT').rfc822()
response.setCookie(self.login_cookie_name, value, path = '/', expires = expires) # response.setCookie(self.login_cookie_name, value, path = '/', expires = expires)
def setLogin(self, username, passwd):
self.login = (username, passwd)
def _getLogin(self, target_realm): def _getLogin(self, target_realm):
request = self.REQUEST request = self.REQUEST
...@@ -268,7 +271,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -268,7 +271,7 @@ class SubversionTool(UniqueObject, Folder):
def checkin(self, path, log_message = 'None', recurse=True): def checkin(self, path, log_message = 'None', recurse=True):
"""Commit local changes. """Commit local changes.
""" """
client = self._getClient() client = self._getClient(login=self.login)
#return client.checkin(self._getWorkingPath(path), log_message, recurse) #return client.checkin(self._getWorkingPath(path), log_message, recurse)
return client.checkin(path, log_message, recurse) return client.checkin(path, log_message, recurse)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment