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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

Remove ivle.webapp.admin.subject#SubjectView (served the subject media
directory almost directly), as it wasn't actually used anywhere and was
causing problems with a hungry URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
                ctx['other_subjects'].append(new_subj)
67
67
 
68
68
 
69
 
class SubjectView(XHTMLView):
70
 
    '''The view of a subject.'''
71
 
    template = 'subject.html'
72
 
    appname = 'subjects' # XXX
73
 
 
74
 
    def __init__(self, req, subject, path):
75
 
        self.subject = req.store.find(Subject, code=subject).one()
76
 
        self.path = path
77
 
 
78
 
    def populate(self, req, ctx):
79
 
        if self.subject is None:
80
 
            raise NotFound()
81
 
 
82
 
        ctx['serve_loc'] = urllib.quote(util.make_path(os.path.join('media',
83
 
                                    'subjects', self.subject.code, self.path)))
84
 
 
85
69
class Plugin(BasePlugin):
86
70
    urls = [
87
71
        ('subjects/', SubjectsView),
88
 
        ('subjects/:subject', SubjectView, {'path': ''}),
89
 
        ('subjects/:subject/*(path)', SubjectView),
90
72
    ]