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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: mattgiuca
  • Date: 2008-08-18 12:15:25 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1027
Tutorial: Added new feature - previous attempt viewing. Allows users to see
    code they have previously submitted to tutorials.
    A new button ("View previous attempts") appears on each exercise box.
    This uses the getattempts and getattempt Ajax services checked in
    previously.
Note once again: Students are not (for the moment) able to see deactivated
attempts (this is a conservative approach - the ability to see deactivated
attempts can be turned on by setting HISTORY_ALLOW_INACTIVE = True in
tutorialservice).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# IVLE - Informatics Virtual Learning Environment
2
 
# Copyright (C) 2007-2009 The University of Melbourne
3
 
#
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; either version 2 of the License, or
7
 
# (at your option) any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
 
 
18
 
# Author: Matt Giuca, Will Grant
19
 
 
20
 
"""
21
 
Database Classes and Utilities for Storm ORM
22
 
 
23
 
This module provides all of the classes which map to database tables.
24
 
It also provides miscellaneous utility functions for database interaction.
25
 
"""
26
 
 
27
 
import md5
28
 
import datetime
29
 
 
30
 
from storm.locals import create_database, Store, Int, Unicode, DateTime, \
31
 
                         Reference, ReferenceSet, Bool, Storm, Desc
32
 
 
33
 
import ivle.conf
34
 
import ivle.caps
35
 
 
36
 
__all__ = ['get_store',
37
 
            'User',
38
 
            'Subject', 'Semester', 'Offering', 'Enrolment',
39
 
            'ProjectSet', 'Project', 'ProjectGroup', 'ProjectGroupMembership',
40
 
            'Exercise', 'Worksheet', 'WorksheetExercise',
41
 
            'ExerciseSave', 'ExerciseAttempt',
42
 
            'AlreadyEnrolledError', 'TestCase', 'TestSuite', 'TestSuiteVar'
43
 
        ]
44
 
 
45
 
def _kwarg_init(self, **kwargs):
46
 
    for k,v in kwargs.items():
47
 
        if k.startswith('_') or not hasattr(self.__class__, k):
48
 
            raise TypeError("%s got an unexpected keyword argument '%s'"
49
 
                % (self.__class__.__name__, k))
50
 
        setattr(self, k, v)
51
 
 
52
 
def get_conn_string():
53
 
    """
54
 
    Returns the Storm connection string, generated from the conf file.
55
 
    """
56
 
    return "postgres://%s:%s@%s:%d/%s" % (ivle.conf.db_user,
57
 
        ivle.conf.db_password, ivle.conf.db_host, ivle.conf.db_port,
58
 
        ivle.conf.db_dbname)
59
 
 
60
 
def get_store():
61
 
    """
62
 
    Open a database connection and transaction. Return a storm.store.Store
63
 
    instance connected to the configured IVLE database.
64
 
    """
65
 
    return Store(create_database(get_conn_string()))
66
 
 
67
 
# USERS #
68
 
 
69
 
class User(Storm):
70
 
    """
71
 
    Represents an IVLE user.
72
 
    """
73
 
    __storm_table__ = "login"
74
 
 
75
 
    id = Int(primary=True, name="loginid")
76
 
    login = Unicode()
77
 
    passhash = Unicode()
78
 
    state = Unicode()
79
 
    rolenm = Unicode()
80
 
    unixid = Int()
81
 
    nick = Unicode()
82
 
    pass_exp = DateTime()
83
 
    acct_exp = DateTime()
84
 
    last_login = DateTime()
85
 
    svn_pass = Unicode()
86
 
    email = Unicode()
87
 
    fullname = Unicode()
88
 
    studentid = Unicode()
89
 
    settings = Unicode()
90
 
 
91
 
    def _get_role(self):
92
 
        if self.rolenm is None:
93
 
            return None
94
 
        return ivle.caps.Role(self.rolenm)
95
 
    def _set_role(self, value):
96
 
        if not isinstance(value, ivle.caps.Role):
97
 
            raise TypeError("role must be an ivle.caps.Role")
98
 
        self.rolenm = unicode(value)
99
 
    role = property(_get_role, _set_role)
100
 
 
101
 
    __init__ = _kwarg_init
102
 
 
103
 
    def __repr__(self):
104
 
        return "<%s '%s'>" % (type(self).__name__, self.login)
105
 
 
106
 
    def authenticate(self, password):
107
 
        """Validate a given password against this user.
108
 
 
109
 
        Returns True if the given password matches the password hash for this
110
 
        User, False if it doesn't match, and None if there is no hash for the
111
 
        user.
112
 
        """
113
 
        if self.passhash is None:
114
 
            return None
115
 
        return self.hash_password(password) == self.passhash
116
 
 
117
 
    def hasCap(self, capability):
118
 
        """Given a capability (which is a Role object), returns True if this
119
 
        User has that capability, False otherwise.
120
 
        """
121
 
        return self.role.hasCap(capability)
122
 
 
123
 
    @property
124
 
    def password_expired(self):
125
 
        fieldval = self.pass_exp
126
 
        return fieldval is not None and datetime.datetime.now() > fieldval
127
 
 
128
 
    @property
129
 
    def account_expired(self):
130
 
        fieldval = self.acct_exp
131
 
        return fieldval is not None and datetime.datetime.now() > fieldval
132
 
 
133
 
    @property
134
 
    def valid(self):
135
 
        return self.state == 'enabled' and not self.account_expired
136
 
 
137
 
    def _get_enrolments(self, justactive):
138
 
        return Store.of(self).find(Enrolment,
139
 
            Enrolment.user_id == self.id,
140
 
            (Enrolment.active == True) if justactive else True,
141
 
            Enrolment.offering_id == Offering.id,
142
 
            Offering.semester_id == Semester.id,
143
 
            Offering.subject_id == Subject.id).order_by(
144
 
                Desc(Semester.year),
145
 
                Desc(Semester.semester),
146
 
                Desc(Subject.code)
147
 
            )
148
 
 
149
 
    def _set_password(self, password):
150
 
        if password is None:
151
 
            self.passhash = None
152
 
        else:
153
 
            self.passhash = unicode(User.hash_password(password))
154
 
    password = property(fset=_set_password)
155
 
 
156
 
    @property
157
 
    def subjects(self):
158
 
        return Store.of(self).find(Subject,
159
 
            Enrolment.user_id == self.id,
160
 
            Enrolment.active == True,
161
 
            Offering.id == Enrolment.offering_id,
162
 
            Subject.id == Offering.subject_id).config(distinct=True)
163
 
 
164
 
    # TODO: Invitations should be listed too?
165
 
    def get_groups(self, offering=None):
166
 
        preds = [
167
 
            ProjectGroupMembership.user_id == self.id,
168
 
            ProjectGroup.id == ProjectGroupMembership.project_group_id,
169
 
        ]
170
 
        if offering:
171
 
            preds.extend([
172
 
                ProjectSet.offering_id == offering.id,
173
 
                ProjectGroup.project_set_id == ProjectSet.id,
174
 
            ])
175
 
        return Store.of(self).find(ProjectGroup, *preds)
176
 
 
177
 
    @property
178
 
    def groups(self):
179
 
        return self.get_groups()
180
 
 
181
 
    @property
182
 
    def active_enrolments(self):
183
 
        '''A sanely ordered list of the user's active enrolments.'''
184
 
        return self._get_enrolments(True)
185
 
 
186
 
    @property
187
 
    def enrolments(self):
188
 
        '''A sanely ordered list of all of the user's enrolments.'''
189
 
        return self._get_enrolments(False) 
190
 
 
191
 
    @staticmethod
192
 
    def hash_password(password):
193
 
        return md5.md5(password).hexdigest()
194
 
 
195
 
    @classmethod
196
 
    def get_by_login(cls, store, login):
197
 
        """
198
 
        Get the User from the db associated with a given store and
199
 
        login.
200
 
        """
201
 
        return store.find(cls, cls.login == unicode(login)).one()
202
 
 
203
 
    def get_permissions(self, user):
204
 
        if user and user.rolenm == 'admin' or user is self:
205
 
            return set(['view', 'edit'])
206
 
        else:
207
 
            return set()
208
 
 
209
 
# SUBJECTS AND ENROLMENTS #
210
 
 
211
 
class Subject(Storm):
212
 
    __storm_table__ = "subject"
213
 
 
214
 
    id = Int(primary=True, name="subjectid")
215
 
    code = Unicode(name="subj_code")
216
 
    name = Unicode(name="subj_name")
217
 
    short_name = Unicode(name="subj_short_name")
218
 
    url = Unicode()
219
 
 
220
 
    offerings = ReferenceSet(id, 'Offering.subject_id')
221
 
 
222
 
    __init__ = _kwarg_init
223
 
 
224
 
    def __repr__(self):
225
 
        return "<%s '%s'>" % (type(self).__name__, self.short_name)
226
 
 
227
 
    def get_permissions(self, user):
228
 
        perms = set()
229
 
        if user is not None:
230
 
            perms.add('view')
231
 
            if user.rolenm == 'admin':
232
 
                perms.add('edit')
233
 
        return perms
234
 
 
235
 
class Semester(Storm):
236
 
    __storm_table__ = "semester"
237
 
 
238
 
    id = Int(primary=True, name="semesterid")
239
 
    year = Unicode()
240
 
    semester = Unicode()
241
 
    active = Bool()
242
 
 
243
 
    offerings = ReferenceSet(id, 'Offering.semester_id')
244
 
 
245
 
    __init__ = _kwarg_init
246
 
 
247
 
    def __repr__(self):
248
 
        return "<%s %s/%s>" % (type(self).__name__, self.year, self.semester)
249
 
 
250
 
class Offering(Storm):
251
 
    __storm_table__ = "offering"
252
 
 
253
 
    id = Int(primary=True, name="offeringid")
254
 
    subject_id = Int(name="subject")
255
 
    subject = Reference(subject_id, Subject.id)
256
 
    semester_id = Int(name="semesterid")
257
 
    semester = Reference(semester_id, Semester.id)
258
 
    groups_student_permissions = Unicode()
259
 
 
260
 
    enrolments = ReferenceSet(id, 'Enrolment.offering_id')
261
 
    members = ReferenceSet(id,
262
 
                           'Enrolment.offering_id',
263
 
                           'Enrolment.user_id',
264
 
                           'User.id')
265
 
    project_sets = ReferenceSet(id, 'ProjectSet.offering_id')
266
 
 
267
 
    worksheets = ReferenceSet(id, 'Worksheet.offering_id')
268
 
 
269
 
    __init__ = _kwarg_init
270
 
 
271
 
    def __repr__(self):
272
 
        return "<%s %r in %r>" % (type(self).__name__, self.subject,
273
 
                                  self.semester)
274
 
 
275
 
    def enrol(self, user):
276
 
        '''Enrol a user in this offering.'''
277
 
        # We'll get a horrible database constraint violation error if we try
278
 
        # to add a second enrolment.
279
 
        if Store.of(self).find(Enrolment,
280
 
                               Enrolment.user_id == user.id,
281
 
                               Enrolment.offering_id == self.id).count() == 1:
282
 
            raise AlreadyEnrolledError()
283
 
 
284
 
        e = Enrolment(user=user, offering=self, active=True)
285
 
        self.enrolments.add(e)
286
 
 
287
 
    def get_permissions(self, user):
288
 
        perms = set()
289
 
        if user is not None:
290
 
            perms.add('view')
291
 
            if user.rolenm == 'admin':
292
 
                perms.add('edit')
293
 
        return perms
294
 
 
295
 
class Enrolment(Storm):
296
 
    __storm_table__ = "enrolment"
297
 
    __storm_primary__ = "user_id", "offering_id"
298
 
 
299
 
    user_id = Int(name="loginid")
300
 
    user = Reference(user_id, User.id)
301
 
    offering_id = Int(name="offeringid")
302
 
    offering = Reference(offering_id, Offering.id)
303
 
    notes = Unicode()
304
 
    active = Bool()
305
 
 
306
 
    @property
307
 
    def groups(self):
308
 
        return Store.of(self).find(ProjectGroup,
309
 
                ProjectSet.offering_id == self.offering.id,
310
 
                ProjectGroup.project_set_id == ProjectSet.id,
311
 
                ProjectGroupMembership.project_group_id == ProjectGroup.id,
312
 
                ProjectGroupMembership.user_id == self.user.id)
313
 
 
314
 
    __init__ = _kwarg_init
315
 
 
316
 
    def __repr__(self):
317
 
        return "<%s %r in %r>" % (type(self).__name__, self.user,
318
 
                                  self.offering)
319
 
 
320
 
class AlreadyEnrolledError(Exception):
321
 
    pass
322
 
 
323
 
# PROJECTS #
324
 
 
325
 
class ProjectSet(Storm):
326
 
    __storm_table__ = "project_set"
327
 
 
328
 
    id = Int(name="projectsetid", primary=True)
329
 
    offering_id = Int(name="offeringid")
330
 
    offering = Reference(offering_id, Offering.id)
331
 
    max_students_per_group = Int()
332
 
 
333
 
    projects = ReferenceSet(id, 'Project.project_set_id')
334
 
    project_groups = ReferenceSet(id, 'ProjectGroup.project_set_id')
335
 
 
336
 
    __init__ = _kwarg_init
337
 
 
338
 
    def __repr__(self):
339
 
        return "<%s %d in %r>" % (type(self).__name__, self.id,
340
 
                                  self.offering)
341
 
 
342
 
class Project(Storm):
343
 
    __storm_table__ = "project"
344
 
 
345
 
    id = Int(name="projectid", primary=True)
346
 
    synopsis = Unicode()
347
 
    url = Unicode()
348
 
    project_set_id = Int(name="projectsetid")
349
 
    project_set = Reference(project_set_id, ProjectSet.id)
350
 
    deadline = DateTime()
351
 
 
352
 
    __init__ = _kwarg_init
353
 
 
354
 
    def __repr__(self):
355
 
        return "<%s '%s' in %r>" % (type(self).__name__, self.synopsis,
356
 
                                  self.project_set.offering)
357
 
 
358
 
class ProjectGroup(Storm):
359
 
    __storm_table__ = "project_group"
360
 
 
361
 
    id = Int(name="groupid", primary=True)
362
 
    name = Unicode(name="groupnm")
363
 
    project_set_id = Int(name="projectsetid")
364
 
    project_set = Reference(project_set_id, ProjectSet.id)
365
 
    nick = Unicode()
366
 
    created_by_id = Int(name="createdby")
367
 
    created_by = Reference(created_by_id, User.id)
368
 
    epoch = DateTime()
369
 
 
370
 
    members = ReferenceSet(id,
371
 
                           "ProjectGroupMembership.project_group_id",
372
 
                           "ProjectGroupMembership.user_id",
373
 
                           "User.id")
374
 
 
375
 
    __init__ = _kwarg_init
376
 
 
377
 
    def __repr__(self):
378
 
        return "<%s %s in %r>" % (type(self).__name__, self.name,
379
 
                                  self.project_set.offering)
380
 
 
381
 
class ProjectGroupMembership(Storm):
382
 
    __storm_table__ = "group_member"
383
 
    __storm_primary__ = "user_id", "project_group_id"
384
 
 
385
 
    user_id = Int(name="loginid")
386
 
    user = Reference(user_id, User.id)
387
 
    project_group_id = Int(name="groupid")
388
 
    project_group = Reference(project_group_id, ProjectGroup.id)
389
 
 
390
 
    __init__ = _kwarg_init
391
 
 
392
 
    def __repr__(self):
393
 
        return "<%s %r in %r>" % (type(self).__name__, self.user,
394
 
                                  self.project_group)
395
 
 
396
 
# WORKSHEETS AND EXERCISES #
397
 
 
398
 
class Exercise(Storm):
399
 
    # Note: Table "problem" is called "Exercise" in the Object layer, since
400
 
    # it's called that everywhere else.
401
 
    __storm_table__ = "problem"
402
 
#TODO: Add in a field for the user-friendly identifier
403
 
    id = Unicode(primary=True, name="identifier")
404
 
    name = Unicode()
405
 
    description = Unicode()
406
 
    partial = Unicode()
407
 
    solution = Unicode()
408
 
    include = Unicode()
409
 
    num_rows = Int()
410
 
 
411
 
    worksheets = ReferenceSet(id,
412
 
        'WorksheetExercise.exercise_id',
413
 
        'WorksheetExercise.worksheet_id',
414
 
        'Worksheet.id'
415
 
    )
416
 
    
417
 
    test_suites = ReferenceSet(id, 'TestSuite.exercise_id')
418
 
 
419
 
    __init__ = _kwarg_init
420
 
 
421
 
    def __repr__(self):
422
 
        return "<%s %s>" % (type(self).__name__, self.name)
423
 
 
424
 
#    @classmethod
425
 
#    def get_by_name(cls, store, name):
426
 
#        """
427
 
#        Get the Exercise from the db associated with a given store and name.
428
 
#        If the exercise is not in the database, creates it and inserts it
429
 
#        automatically.
430
 
#        """
431
 
#        ex = store.find(cls, cls.name == unicode(name)).one()
432
 
#        if ex is not None:
433
 
#            return ex
434
 
#        ex = Exercise(name=unicode(name))
435
 
#        store.add(ex)
436
 
#        store.commit()
437
 
#        return ex
438
 
 
439
 
class Worksheet(Storm):
440
 
    __storm_table__ = "worksheet"
441
 
 
442
 
    id = Int(primary=True, name="worksheetid")
443
 
    # XXX subject is not linked to a Subject object. This is a property of
444
 
    # the database, and will be refactored.
445
 
    subject = Unicode()
446
 
    offering_id = Int(name="offeringid")
447
 
    name = Unicode(name="identifier")
448
 
    assessable = Bool()
449
 
    mtime = DateTime()
450
 
 
451
 
    attempts = ReferenceSet(id, "ExerciseAttempt.worksheetid")
452
 
    offering = Reference(offering_id, 'Offering.id')
453
 
 
454
 
    exercises = ReferenceSet(id,
455
 
        'WorksheetExercise.worksheet_id',
456
 
        'WorksheetExercise.exercise_id',
457
 
        Exercise.id)
458
 
    # Use worksheet_exercises to get access to the WorksheetExercise objects
459
 
    # binding worksheets to exercises. This is required to access the
460
 
    # "optional" field.
461
 
    worksheet_exercises = ReferenceSet(id,
462
 
        'WorksheetExercise.worksheet_id')
463
 
        
464
 
 
465
 
    __init__ = _kwarg_init
466
 
 
467
 
    def __repr__(self):
468
 
        return "<%s %s>" % (type(self).__name__, self.name)
469
 
 
470
 
    # XXX Refactor this - make it an instance method of Subject rather than a
471
 
    # class method of Worksheet. Can't do that now because Subject isn't
472
 
    # linked referentially to the Worksheet.
473
 
    @classmethod
474
 
    def get_by_name(cls, store, subjectname, worksheetname):
475
 
        """
476
 
        Get the Worksheet from the db associated with a given store, subject
477
 
        name and worksheet name.
478
 
        """
479
 
        return store.find(cls, cls.subject == unicode(subjectname),
480
 
            cls.name == unicode(worksheetname)).one()
481
 
 
482
 
    def remove_all_exercises(self, store):
483
 
        """
484
 
        Remove all exercises from this worksheet.
485
 
        This does not delete the exercises themselves. It just removes them
486
 
        from the worksheet.
487
 
        """
488
 
        store.find(WorksheetExercise,
489
 
            WorksheetExercise.worksheet == self).remove()
490
 
            
491
 
    def get_permissions(self, user):
492
 
        return self.offering.get_permissions(user)
493
 
 
494
 
class WorksheetExercise(Storm):
495
 
    __storm_table__ = "worksheet_problem"
496
 
    __storm_primary__ = "worksheet_id", "exercise_id"
497
 
 
498
 
    worksheet_id = Int(name="worksheetid")
499
 
    worksheet = Reference(worksheet_id, Worksheet.id)
500
 
    exercise_id = Unicode(name="problemid")
501
 
    exercise = Reference(exercise_id, Exercise.id)
502
 
    optional = Bool()
503
 
 
504
 
    __init__ = _kwarg_init
505
 
 
506
 
    def __repr__(self):
507
 
        return "<%s %s in %s>" % (type(self).__name__, self.exercise.name,
508
 
                                  self.worksheet.name)
509
 
 
510
 
class ExerciseSave(Storm):
511
 
    """
512
 
    Represents a potential solution to an exercise that a user has submitted
513
 
    to the server for storage.
514
 
    A basic ExerciseSave is just the current saved text for this exercise for
515
 
    this user (doesn't count towards their attempts).
516
 
    ExerciseSave may be extended with additional semantics (such as
517
 
    ExerciseAttempt).
518
 
    """
519
 
    __storm_table__ = "problem_save"
520
 
    __storm_primary__ = "exercise_id", "user_id", "date"
521
 
 
522
 
    exercise_id = Unicode(name="problemid")
523
 
    exercise = Reference(exercise_id, Exercise.id)
524
 
    user_id = Int(name="loginid")
525
 
    user = Reference(user_id, User.id)
526
 
    date = DateTime()
527
 
    text = Unicode()
528
 
    worksheetid = Int()
529
 
    worksheet = Reference(worksheetid, Worksheet.id)
530
 
 
531
 
    __init__ = _kwarg_init
532
 
 
533
 
    def __repr__(self):
534
 
        return "<%s %s by %s at %s>" % (type(self).__name__,
535
 
            self.exercise.name, self.user.login, self.date.strftime("%c"))
536
 
 
537
 
class ExerciseAttempt(ExerciseSave):
538
 
    """
539
 
    An ExerciseAttempt is a special case of an ExerciseSave. Like an
540
 
    ExerciseSave, it constitutes exercise solution data that the user has
541
 
    submitted to the server for storage.
542
 
    In addition, it contains additional information about the submission.
543
 
    complete - True if this submission was successful, rendering this exercise
544
 
        complete for this user.
545
 
    active - True if this submission is "active" (usually true). Submissions
546
 
        may be de-activated by privileged users for special reasons, and then
547
 
        they won't count (either as a penalty or success), but will still be
548
 
        stored.
549
 
    """
550
 
    __storm_table__ = "problem_attempt"
551
 
    __storm_primary__ = "exercise_id", "user_id", "date"
552
 
 
553
 
    # The "text" field is the same but has a different name in the DB table
554
 
    # for some reason.
555
 
    text = Unicode(name="attempt")
556
 
    complete = Bool()
557
 
    active = Bool()
558
 
    
559
 
    def get_permissions(self, user):
560
 
        return set(['view']) if user is self.user else set()
561
 
  
562
 
class TestSuite(Storm):
563
 
    """A Testsuite acts as a container for the test cases of an exercise."""
564
 
    __storm_table__ = "test_suite"
565
 
    __storm_primary__ = "exercise_id", "suiteid"
566
 
    
567
 
    suiteid = Int()
568
 
    exercise_id = Unicode(name="problemid")
569
 
    description = Unicode()
570
 
    seq_no = Int()
571
 
    function = Unicode()
572
 
    stdin = Unicode()
573
 
    exercise = Reference(exercise_id, Exercise.id)
574
 
    test_cases = ReferenceSet(suiteid, 'TestCase.suiteid')
575
 
    variables = ReferenceSet(suiteid, 'TestSuiteVar.suiteid')
576
 
 
577
 
class TestCase(Storm):
578
 
    """A TestCase is a member of a TestSuite.
579
 
    
580
 
    It contains the data necessary to check if an exercise is correct"""
581
 
    __storm_table__ = "test_case"
582
 
    __storm_primary__ = "testid", "suiteid"
583
 
    
584
 
    testid = Int()
585
 
    suiteid = Int()
586
 
    suite = Reference(suiteid, "TestSuite.suiteid")
587
 
    passmsg = Unicode()
588
 
    failmsg = Unicode()
589
 
    test_default = Unicode()
590
 
    seq_no = Int()
591
 
    
592
 
    parts = ReferenceSet(testid, "TestCasePart.testid")
593
 
    
594
 
    __init__ = _kwarg_init
595
 
 
596
 
class TestSuiteVar(Storm):
597
 
    """A container for the arguments of a Test Suite"""
598
 
    __storm_table__ = "suite_variables"
599
 
    __storm_primary__ = "varid"
600
 
    
601
 
    varid = Int()
602
 
    suiteid = Int()
603
 
    var_name = Unicode()
604
 
    var_value = Unicode()
605
 
    var_type = Unicode()
606
 
    arg_no = Int()
607
 
    
608
 
    suite = Reference(suiteid, "TestSuite.suiteid")
609
 
    
610
 
    __init__ = _kwarg_init
611
 
    
612
 
class TestCasePart(Storm):
613
 
    """A container for the test elements of a Test Case"""
614
 
    __storm_table__ = "test_case_parts"
615
 
    __storm_primary__ = "partid"
616
 
    
617
 
    partid = Int()
618
 
    testid = Int()
619
 
    
620
 
    part_type = Unicode()
621
 
    test_type = Unicode()
622
 
    data = Unicode()
623
 
    filename = Unicode()
624
 
    
625
 
    test = Reference(testid, "TestCase.testid")
626
 
    
627
 
    __init__ = _kwarg_init