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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: Matt Giuca
  • Date: 2009-01-19 03:46:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: matt.giuca@gmail.com-20090119034646-te8atq1sd6cnnk0w
ivle.database: Added Worksheet and Exercise classes (more to come in this
    category).

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
            'User',
38
38
            'Subject', 'Semester', 'Offering', 'Enrolment',
39
39
            'ProjectSet', 'Project', 'ProjectGroup', 'ProjectGroupMembership',
 
40
            'Exercise', 'Worksheet',
40
41
        ]
41
42
 
42
43
def _kwarg_init(self, **kwargs):
319
320
        return "<%s %r in %r>" % (type(self).__name__, self.user,
320
321
                                  self.project_group)
321
322
 
322
 
 
 
323
# WORKSHEETS AND EXERCISES #
 
324
 
 
325
class Exercise(Storm):
 
326
    # Note: Table "problem" is called "Exercise" in the Object layer, since
 
327
    # it's called that everywhere else.
 
328
    __storm_table__ = "problem"
 
329
 
 
330
    id = Int(primary=True, name="problemid")
 
331
    name = Unicode(name="identifier")
 
332
    spec = Unicode()
 
333
 
 
334
    __init__ = _kwarg_init
 
335
 
 
336
    def __repr__(self):
 
337
        return "<%s %s>" % (type(self).__name__, self.name)
 
338
 
 
339
class Worksheet(Storm):
 
340
    __storm_table__ = "worksheet"
 
341
 
 
342
    id = Int(primary=True, name="worksheetid")
 
343
    # XXX subject is not linked to a Subject object. This is a property of
 
344
    # the database, and will be refactored.
 
345
    subject = Unicode()
 
346
    name = Unicode(name="identifier")
 
347
    assessable = Bool()
 
348
    mtime = DateTime()
 
349
 
 
350
    __init__ = _kwarg_init
 
351
 
 
352
    def __repr__(self):
 
353
        return "<%s %s>" % (type(self).__name__, self.name)