~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/fileservice_lib/action.py

  • Committer: Matt Giuca
  • Date: 2009-12-15 03:16:19 UTC
  • Revision ID: matt.giuca@gmail.com-20091215031619-ce4hyebh5uesphys
ivle.svn: Abstracted creation of Subversion client object, with authentication callback, from fileservice_lib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
from ivle import (util, studpath, zip)
145
145
from ivle.fileservice_lib.exceptions import WillNotOverwrite
146
146
import ivle.conf
147
 
 
148
 
 
149
 
def get_login(_realm, existing_login, _may_save):
150
 
    """Callback function used by pysvn for authentication.
151
 
    realm, existing_login, _may_save: The 3 arguments passed by pysvn to
152
 
        callback_get_login.
153
 
        The following has been determined empirically, not from docs:
154
 
        existing_login will be the name of the user who owns the process on
155
 
        the first attempt, "" on subsequent attempts. We use this fact.
156
 
    """
157
 
    # Only provide credentials on the _first_ attempt.
158
 
    # If we're being asked again, then it means the credentials failed for
159
 
    # some reason and we should just fail. (This is not desirable, but it's
160
 
    # better than being asked an infinite number of times).
161
 
    return (existing_login != "", str(ivle.conf.login),
162
 
                                  str(ivle.conf.svn_pass), True)
163
 
 
164
 
# Make a Subversion client object
165
 
svnclient = pysvn.Client()
166
 
svnclient.callback_get_login = get_login
 
147
import ivle.svn
 
148
 
 
149
# Make a Subversion client object (which will log in with this user's
 
150
# credentials, upon request)
 
151
svnclient = ivle.svn.create_auth_svn_client(username=ivle.conf.login,
 
152
                                            password=ivle.conf.svn_pass)
167
153
svnclient.exception_style = 0               # Simple (string) exceptions
168
154
 
169
155
DEFAULT_LOGMESSAGE = "No log message supplied."