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

« back to all changes in this revision

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

  • Committer: Nick Chadwick
  • Date: 2009-03-17 01:42:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1162.
  • Revision ID: chadnickbok@gmail.com-20090317014219-e0dvzakaxw58b71p
Fixed a problem with exercise editor, which wasn't editing or adding
variables properly.

Fixed the final issues from the merge-proposal, which make deleting
exercises use appropriate functions, which now raise exceptions
if they fail.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    @named_operation(u'edit')
86
86
    def delete_exercise(self, req, id):
87
87
        
88
 
        if self.context.delete(req.store):
89
 
            return {'result': 'ok'}
90
 
        else:
91
 
            raise BadRequest()
92
 
    
 
88
        self.context.delete()
 
89
        return {'result': 'ok'}
 
90
 
93
91
    @named_operation(u'edit')
94
92
    def add_suite(self, req, description, function, stdin):
95
93
        
129
127
        if suite is None:
130
128
            raise NotFound()
131
129
        
132
 
        suite.delete(req.store)
 
130
        suite.delete()
133
131
        
134
132
        return {'result': 'ok'}
135
133
      
162
160
        ).one()
163
161
        
164
162
        if var is None:
165
 
            raise NotFound()
 
163
            raise NotFound("Var not found.")
166
164
            
167
165
        var.var_type = unicode(var_type)
168
166
        var.var_name = unicode(var_name)
179
177
        if var is None:
180
178
            raise NotFound()
181
179
        
182
 
        var.delete(req.store)
 
180
        var.delete()
183
181
        
184
182
        return {'result': 'ok'}
185
183
        
240
238
        if test_case is None:   
241
239
            raise NotFound()
242
240
 
243
 
        test_case.delete(req.store)
 
241
        test_case.delete()
244
242
 
245
243
        return {'result': 'ok'}
246
244
    
319
317
        if test_part is None:
320
318
            raise NotFound()
321
319
        
322
 
        test_part.delete(req.store)
 
320
        test_part.delete()
323
321
        
324
322
        return {'result': 'ok'}