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

« back to all changes in this revision

Viewing changes to ivle/svn.py

  • Committer: Matt Giuca
  • Date: 2009-12-15 05:04:07 UTC
  • Revision ID: matt.giuca@gmail.com-20091215050407-1akof7tyd33qt2rd
ivle.svn: Added create_auth_svn_client_autopass, which gets a svnclient object without needing a password (looks it up in the DB).

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
import pysvn
25
25
 
 
26
def create_auth_svn_client_autopass(username):
 
27
    """Create a new pysvn client which is set up to automatically authenticate
 
28
    with the supplied user. The user's Subversion password is automatically
 
29
    looked up in the database.
 
30
    (Requires database access -- can't be used inside the jail.)
 
31
    @param username: IVLE/Subversion username.
 
32
    """
 
33
    # Note: Must do this inside the function, since this file may be used in
 
34
    # the jail, and importing ivle.database crashes in the jail.
 
35
    from ivle.config import Config
 
36
    import ivle.database
 
37
    from ivle.database import User
 
38
    store = ivle.database.get_store(Config())
 
39
    user = store.find(User, User.login==unicode(username)).one()
 
40
    return create_auth_svn_client(username, user.svn_pass)
 
41
 
26
42
def create_auth_svn_client(username, password):
27
43
    """Create a new pysvn client which is set up to automatically authenticate
28
44
    with the supplied credentials.
 
45
    @param username: IVLE/Subversion username.
 
46
    @param password: Subversion password.
29
47
    """
30
48
    username = str(username)
31
49
    password = str(password)