~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-05-19 02:54:08 UTC
  • mfrom: (1258 trunk)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: matt.giuca@gmail.com-20090519025408-19c7cjl7w6ot6frm
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
import os
132
132
import cStringIO
133
133
import shutil
 
134
import urllib
134
135
 
135
136
import pysvn
136
137
 
197
198
    except KeyError:
198
199
        # Default, just send an error but then continue
199
200
        raise ActionError("Unknown action")
200
 
    action(req, fields)
 
201
    return action(req, fields)
201
202
 
202
203
def actionpath_to_urlpath(req, path):
203
204
    """Determines the URL path (relative to the student home) upon which the
713
714
    paths = fields.getlist('path')
714
715
    if len(paths) != 2:
715
716
        raise ActionError("usage: svncheckout url local-path")
716
 
    url = ivle.conf.svn_addr + "/" + paths[0]
 
717
    url = ivle.conf.svn_addr + "/" + urllib.quote(paths[0])
717
718
    local_path = actionpath_to_local(req, str(paths[1]))
718
719
    try:
719
720
        svnclient.callback_get_login = get_login
738
739
def action_svnrepostat(req, fields):
739
740
    """Discovers whether a path exists in a repo under the IVLE SVN root.
740
741
 
 
742
    If it does exist, returns a dict containing its metadata.
 
743
 
741
744
    Reads fields: 'path'
742
745
    """
743
746
    path = fields.getfirst('path')
744
747
    url = ivle.conf.svn_addr + "/" + path
745
 
    svnclient.exception_style = 1 
 
748
    svnclient.exception_style = 1
746
749
 
747
750
    try:
748
751
        svnclient.callback_get_login = get_login
749
 
        svnclient.info2(url)
 
752
        info = svnclient.info2(url,
 
753
            revision=pysvn.Revision(pysvn.opt_revision_kind.head))[0][1]
 
754
        return {'svnrevision': info['rev'].number
 
755
                  if info['rev'] and
 
756
                     info['rev'].kind == pysvn.opt_revision_kind.number
 
757
                  else None}
750
758
    except pysvn.ClientError, e:
751
759
        # Error code 170000 means ENOENT in this revision.
752
760
        if e[1][0][1] == 170000: