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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: mattgiuca
  • Date: 2007-12-13 03:59:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:51
src/conf: Set svn:ignore so it will not present conf.py for committing.

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