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

« back to all changes in this revision

Viewing changes to bin/ivle-fetchsubmissions

  • Committer: David Coles
  • Date: 2010-08-30 03:26:13 UTC
  • Revision ID: coles.david@gmail.com-20100830032613-d14vng0jkelniu3l
python-console: Fix globals broken with new JSON library.

simplejson always returns unicode strings. cJSON would return ordinary strings 
if possible. cPickle.loads() only accepts strings. At present we use pickle 
version 0 so they should all works as ASCII strings. Higher versions of pickle 
are not plain ASCII and are likely to break this and so this should be fixed 
at some point.

Also replaced unconditional exception with one that catches Pickle errors. Not 
sure the best way to report failures of these functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import optparse
33
33
import zipfile
34
34
import traceback
 
35
import locale
35
36
 
36
37
import pysvn
37
38
 
45
46
 
46
47
from ivle.database import Project, ProjectSet, Offering, Subject
47
48
 
 
49
# Set locale to UTF-8
 
50
locale.setlocale(locale.LC_CTYPE, "en_US.UTF-8")
 
51
 
48
52
# Is Python version 2.6 or higher?
49
53
PYTHON26 = map(int, sys.version[:3].split('.')) >= [2, 6]
50
54
 
114
118
        # The name of the repository directory within 'groups' is
115
119
        # SUBJECT_YEAR_SEMESTER_GROUP
116
120
        namespace = "_".join([offering.subject.short_name,
117
 
            offering.semester.year, offering.semester.semester, groupname])
 
121
            offering.semester.year, offering.semester.url_name, groupname])
118
122
        repo_path = os.path.join(config['paths']['svn']['repo_path'],
119
123
                                'groups', namespace)
120
124
    else:
308
312
 
309
313
    # Target directory is DEST/subject/year/semester/project
310
314
    target_dir = os.path.join(options.dest, subject_name,
311
 
        offering.semester.year, offering.semester.semester, project_name)
 
315
        offering.semester.year, offering.semester.url_name, project_name)
312
316
    if not os.path.exists(target_dir):
313
317
        os.makedirs(target_dir)
314
318