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

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/__init__.py

  • Committer: Nick Chadwick
  • Date: 2009-02-25 16:36:02 UTC
  • mto: (1099.1.227 exercise-ui)
  • mto: This revision was merged to the branch mainline in revision 1162.
  • Revision ID: chadnickbok@gmail.com-20090225163602-vr6mym3wsa6bxa8d
tutorials can now use RST

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
 
170
170
    def populate(self, req, ctx):
171
171
        self.plugin_scripts[Plugin] = ['tutorial.js']
172
 
        self.plugin_styles[Plugin] = ['tutorial.css']
 
172
        self.plugin_styles[Plugin] = ['tutorial.css', 'worksheet.css']
173
173
 
174
174
        if not self.context:
175
175
            raise NotFound()
178
178
        ctx['worksheet'] = self.context
179
179
        ctx['semester'] = self.semester
180
180
        ctx['year'] = self.year
181
 
        ctx['worksheetstream'] = genshi.Stream(list(genshi.XML(self.context.data)))
 
181
        if self.context.format == 'rst':
 
182
            ws_xml = '<worksheet>' + rstfunc(self.context.data) + '</worksheet>'
 
183
        else:
 
184
            ws_xml = self.context.data
 
185
        ctx['worksheetstream'] = genshi.Stream(list(genshi.XML(ws_xml)))
182
186
 
183
187
        generate_worksheet_data(ctx, req, self.context)
184
188
 
333
337
    # work than we need. We just need to get the exercise name and a few other
334
338
    # fields from the XML.
335
339
 
336
 
    #TODO: Replace calls to minidom with calls to the database directly
337
340
    curctx['exercise'] = exercise
338
341
    if exercise.description is not None:
339
342
        desc = rstfunc(exercise.description)