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

« back to all changes in this revision

Viewing changes to bin/ivle-fetchsubmissions

  • Committer: William Grant
  • Date: 2009-05-13 03:15:26 UTC
  • mto: This revision was merged to the branch mainline in revision 1247.
  • Revision ID: grantw@unimelb.edu.au-20090513031526-l3knlkpgnldp6dgj
Attempting to view an SVN log when the repo is empty will not crash now.

svnlogservice now returns a 404 if the revision isn't found.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
PYTHON26 = map(int, sys.version[:3].split('.')) >= [2, 6]
50
50
 
51
51
def fetch_submission(submission, target, svnclient, config, zip=False,
52
 
    txt=False, verbose=False):
 
52
    txt=False):
53
53
    """Fetch a submission from a user's repository, and dump it in a given
54
54
    directory.
55
55
    @param submission: Submission object, detailing the submission.
60
60
    @param zip: If True, zips up the submission.
61
61
    @param txt: If True, writes an extra text file with metadata about the
62
62
        submission.
63
 
    @param verbose: If True, writes the name of each submission to stdout.
64
63
    """
65
64
    # submission_name is the name of the user or group who owns the repo
66
65
    submission_name = submission.assessed.principal.short_name
94
93
        else:
95
94
            os.remove(target_final)
96
95
 
97
 
    if verbose:
98
 
        print "Exported submission by: %s (%s)" % (
99
 
            submission.assessed.principal.short_name,
100
 
            submission.assessed.principal.display_name)
101
 
 
102
96
def get_repo_url(submission, config):
103
97
    """Gets a local (file:) URL to the repository for a given submission.
104
98
    This will consult submission.path to find the path within the repository
232
226
        action="store_true", dest="zip",
233
227
        help="Store each submission in a Zip file.",
234
228
        default=False)
235
 
    parser.add_option("-v", "--verbose",
236
 
        action="store_true", dest="verbose",
237
 
        help="Print out the name of each submission as it is extracted.",
238
 
        default=False)
239
229
    parser.add_option("--no-txt",
240
230
        action="store_false", dest="txt",
241
231
        help="Disable writing a text file with data about each submission.",
315
305
    for submission in project.latest_submissions:
316
306
        try:
317
307
            fetch_submission(submission, target_dir, svnclient, config,
318
 
                             zip=options.zip, txt=options.txt,
319
 
                             verbose=options.verbose)
 
308
                             zip=options.zip, txt=options.txt)
320
309
        except Exception, e:
321
310
            # Catch all exceptions (to ensure if one student has a problem, it
322
311
            # is reported, and we can continue)