Commit 1a9de5a9 authored by Christophe Dumez's avatar Christophe Dumez

- Worked on commit (login/cookie is working + SSL Trust)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6431 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4853cc2c
......@@ -59,9 +59,13 @@ try:
class SubversionLoginError(SubversionError):
"""Raised when an authentication is required.
"""
# Declarative Security
security = ClassSecurityInfo()
def __init__(self, realm = None):
self._realm = realm
security.declarePublic('getRealm')
def getRealm(self):
return self._realm
......@@ -105,7 +109,7 @@ try:
class GetLoginCallback(Callback):
def __call__(self, realm, username, may_save):
user, password = self.client.getLogin(realm)
if user is None:
if not username or not password:
self.client.setException(SubversionLoginError(realm))
#raise SubversionLoginError(realm)
return False, '', '', False
......@@ -197,10 +201,14 @@ try:
#self.client.callback_ssl_server_trust_prompt = self.callback_ssl_server_trust_prompt
self.creation_time = time.time()
self.__dict__.update(kw)
self.exception = None
def getLogMessage(self):
return self.log_message
def getLogin(self, realm):
return self.aq_parent._getLogin(realm)
def _getPreferences(self):
self.working_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy')
if not self.working_path :
......@@ -237,8 +245,12 @@ try:
self._getPreferences()
try:
return self.client.checkin(path, log_message=log_message, recurse=recurse)
except pysvn.ClientError:
raise self.getException()
except pysvn.ClientError, error:
excep = self.getException()
if excep:
raise excep
else:
raise error
def status(self, path, **kw):
# Since plain Python classes are not convenient in Zope, convert the objects.
......@@ -258,6 +270,8 @@ try:
InitializeClass(SubversionSSLTrustError)
allow_class(SubversionSSLTrustError)
InitializeClass(SubversionLoginError)
allow_class(SubversionLoginError)
except ImportError:
from zLOG import LOG, WARNING
......
......@@ -386,9 +386,6 @@ class SubversionTool(UniqueObject, Folder):
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
cookie = request.get(self.login_cookie_name)
......
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