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

« back to all changes in this revision

Viewing changes to bin/ivle-fetchsubmissions

  • Committer: Matt Giuca
  • Date: 2009-05-12 14:08:16 UTC
  • mto: This revision was merged to the branch mainline in revision 1247.
  • Revision ID: matt.giuca@gmail.com-20090512140816-5bo7ivldhsc29hsw
ivle-fetchsubmissions: Added --no-txt option to disable writing the text files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
from ivle.database import Project, ProjectSet, Offering, Subject
46
46
 
47
 
def fetch_submission(submission, target, svnclient, config, zip=False):
 
47
def fetch_submission(submission, target, svnclient, config, zip=False,
 
48
    txt=False):
48
49
    """Fetch a submission from a user's repository, and dump it in a given
49
50
    directory.
50
51
    @param submission: Submission object, detailing the submission.
53
54
    @param svnclient: pysvn.Client object.
54
55
    @param config: Config object.
55
56
    @param zip: If True, zips up the submission.
 
57
    @param txt: If True, writes an extra text file with metadata about the
 
58
        submission.
56
59
    """
57
60
    # submission_name is the name of the user or group who owns the repo
58
61
    submission_name = submission.assessed.principal.name
66
69
    svnclient.export(url, target_final, force=True,
67
70
        revision=revision, recurse=True)
68
71
 
69
 
    # info_final is the directory to place the metadata info files in
70
 
    info_final = target_final + ".txt"
71
 
    write_submission_info(info_final, submission)
 
72
    if txt:
 
73
        # info_final is the directory to place the metadata info files in
 
74
        info_final = target_final + ".txt"
 
75
        write_submission_info(info_final, submission)
72
76
 
73
77
    # If required, zip up the directory
74
78
    if zip:
193
197
        action="store_true", dest="zip",
194
198
        help="Store each submission in a Zip file.",
195
199
        default=False)
 
200
    parser.add_option("--no-txt",
 
201
        action="store_false", dest="txt",
 
202
        help="Disable writing a text file with data about each submission.",
 
203
        default=True)
196
204
    (options, args) = parser.parse_args(argv[1:])
197
205
 
198
206
    if len(args) < 2:
268
276
    for submission in project.latest_submissions:
269
277
        try:
270
278
            fetch_submission(submission, target_dir, svnclient, config,
271
 
                             zip=options.zip)
 
279
                             zip=options.zip, txt=options.txt)
272
280
        except Exception, e:
273
281
            # Catch all exceptions (to ensure if one student has a problem, it
274
282
            # is reported, and we can continue)