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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: mattgiuca
  • Date: 2007-12-06 22:38:46 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:9
Added prototypes directory. Added ajax file browser proof-of-concept demo.

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
 
from ivle.worksheet.rst import rst
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
 
 
240
 
    __init__ = _kwarg_init
241
 
 
242
 
    def __repr__(self):
243
 
        return "<%s %s/%s>" % (type(self).__name__, self.year, self.semester)
244
 
 
245
 
class Offering(Storm):
246
 
    __storm_table__ = "offering"
247
 
 
248
 
    id = Int(primary=True, name="offeringid")
249
 
    subject_id = Int(name="subject")
250
 
    subject = Reference(subject_id, Subject.id)
251
 
    semester_id = Int(name="semesterid")
252
 
    semester = Reference(semester_id, Semester.id)
253
 
    groups_student_permissions = Unicode()
254
 
 
255
 
    enrolments = ReferenceSet(id, 'Enrolment.offering_id')
256
 
    members = ReferenceSet(id,
257
 
                           'Enrolment.offering_id',
258
 
                           'Enrolment.user_id',
259
 
                           'User.id')
260
 
    project_sets = ReferenceSet(id, 'ProjectSet.offering_id')
261
 
 
262
 
    worksheets = ReferenceSet(id, 
263
 
        'Worksheet.offering_id', 
264
 
        order_by="seq_no"
265
 
    )
266
 
 
267
 
    __init__ = _kwarg_init
268
 
 
269
 
    def __repr__(self):
270
 
        return "<%s %r in %r>" % (type(self).__name__, self.subject,
271
 
                                  self.semester)
272
 
 
273
 
    def enrol(self, user, role=u'student'):
274
 
        '''Enrol a user in this offering.'''
275
 
        enrolment = Store.of(self).find(Enrolment,
276
 
                               Enrolment.user_id == user.id,
277
 
                               Enrolment.offering_id == self.id).one()
278
 
 
279
 
        if enrolment is None:
280
 
            enrolment = Enrolment(user=user, offering=self)
281
 
            self.enrolments.add(enrolment)
282
 
 
283
 
        enrolment.active = True
284
 
        enrolment.role = role
285
 
 
286
 
    def get_permissions(self, user):
287
 
        perms = set()
288
 
        if user is not None:
289
 
            perms.add('view')
290
 
            if user.admin:
291
 
                perms.add('edit')
292
 
        return perms
293
 
 
294
 
class Enrolment(Storm):
295
 
    __storm_table__ = "enrolment"
296
 
    __storm_primary__ = "user_id", "offering_id"
297
 
 
298
 
    user_id = Int(name="loginid")
299
 
    user = Reference(user_id, User.id)
300
 
    offering_id = Int(name="offeringid")
301
 
    offering = Reference(offering_id, Offering.id)
302
 
    role = Unicode()
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
 
# PROJECTS #
321
 
 
322
 
class ProjectSet(Storm):
323
 
    __storm_table__ = "project_set"
324
 
 
325
 
    id = Int(name="projectsetid", primary=True)
326
 
    offering_id = Int(name="offeringid")
327
 
    offering = Reference(offering_id, Offering.id)
328
 
    max_students_per_group = Int()
329
 
 
330
 
    projects = ReferenceSet(id, 'Project.project_set_id')
331
 
    project_groups = ReferenceSet(id, 'ProjectGroup.project_set_id')
332
 
 
333
 
    __init__ = _kwarg_init
334
 
 
335
 
    def __repr__(self):
336
 
        return "<%s %d in %r>" % (type(self).__name__, self.id,
337
 
                                  self.offering)
338
 
 
339
 
class Project(Storm):
340
 
    __storm_table__ = "project"
341
 
 
342
 
    id = Int(name="projectid", primary=True)
343
 
    synopsis = Unicode()
344
 
    url = Unicode()
345
 
    project_set_id = Int(name="projectsetid")
346
 
    project_set = Reference(project_set_id, ProjectSet.id)
347
 
    deadline = DateTime()
348
 
 
349
 
    __init__ = _kwarg_init
350
 
 
351
 
    def __repr__(self):
352
 
        return "<%s '%s' in %r>" % (type(self).__name__, self.synopsis,
353
 
                                  self.project_set.offering)
354
 
 
355
 
class ProjectGroup(Storm):
356
 
    __storm_table__ = "project_group"
357
 
 
358
 
    id = Int(name="groupid", primary=True)
359
 
    name = Unicode(name="groupnm")
360
 
    project_set_id = Int(name="projectsetid")
361
 
    project_set = Reference(project_set_id, ProjectSet.id)
362
 
    nick = Unicode()
363
 
    created_by_id = Int(name="createdby")
364
 
    created_by = Reference(created_by_id, User.id)
365
 
    epoch = DateTime()
366
 
 
367
 
    members = ReferenceSet(id,
368
 
                           "ProjectGroupMembership.project_group_id",
369
 
                           "ProjectGroupMembership.user_id",
370
 
                           "User.id")
371
 
 
372
 
    __init__ = _kwarg_init
373
 
 
374
 
    def __repr__(self):
375
 
        return "<%s %s in %r>" % (type(self).__name__, self.name,
376
 
                                  self.project_set.offering)
377
 
 
378
 
class ProjectGroupMembership(Storm):
379
 
    __storm_table__ = "group_member"
380
 
    __storm_primary__ = "user_id", "project_group_id"
381
 
 
382
 
    user_id = Int(name="loginid")
383
 
    user = Reference(user_id, User.id)
384
 
    project_group_id = Int(name="groupid")
385
 
    project_group = Reference(project_group_id, ProjectGroup.id)
386
 
 
387
 
    __init__ = _kwarg_init
388
 
 
389
 
    def __repr__(self):
390
 
        return "<%s %r in %r>" % (type(self).__name__, self.user,
391
 
                                  self.project_group)
392
 
 
393
 
# WORKSHEETS AND EXERCISES #
394
 
 
395
 
class Exercise(Storm):
396
 
    __storm_table__ = "exercise"
397
 
    id = Unicode(primary=True, name="identifier")
398
 
    name = Unicode()
399
 
    description = Unicode()
400
 
    partial = Unicode()
401
 
    solution = Unicode()
402
 
    include = Unicode()
403
 
    num_rows = Int()
404
 
 
405
 
    worksheets = ReferenceSet(id,
406
 
        'WorksheetExercise.exercise_id',
407
 
        'WorksheetExercise.worksheet_id',
408
 
        'Worksheet.id'
409
 
    )
410
 
    
411
 
    test_suites = ReferenceSet(id, 
412
 
        'TestSuite.exercise_id',
413
 
        order_by='seq_no')
414
 
 
415
 
    __init__ = _kwarg_init
416
 
 
417
 
    def __repr__(self):
418
 
        return "<%s %s>" % (type(self).__name__, self.name)
419
 
 
420
 
    def get_permissions(self, user):
421
 
        perms = set()
422
 
        if user is not None:
423
 
            if user.admin:
424
 
                perms.add('edit')
425
 
                perms.add('view')
426
 
        return perms
427
 
 
428
 
class Worksheet(Storm):
429
 
    __storm_table__ = "worksheet"
430
 
 
431
 
    id = Int(primary=True, name="worksheetid")
432
 
    offering_id = Int(name="offeringid")
433
 
    identifier = Unicode()
434
 
    name = Unicode()
435
 
    assessable = Bool()
436
 
    data = Unicode()
437
 
    seq_no = Int()
438
 
    format = Unicode()
439
 
 
440
 
    attempts = ReferenceSet(id, "ExerciseAttempt.worksheetid")
441
 
    offering = Reference(offering_id, 'Offering.id')
442
 
 
443
 
    all_worksheet_exercises = ReferenceSet(id,
444
 
        'WorksheetExercise.worksheet_id')
445
 
 
446
 
    # Use worksheet_exercises to get access to the *active* WorksheetExercise
447
 
    # objects binding worksheets to exercises. This is required to access the
448
 
    # "optional" field.
449
 
 
450
 
    @property
451
 
    def worksheet_exercises(self):
452
 
        return self.all_worksheet_exercises.find(active=True)
453
 
 
454
 
    __init__ = _kwarg_init
455
 
 
456
 
    def __repr__(self):
457
 
        return "<%s %s>" % (type(self).__name__, self.name)
458
 
 
459
 
    # XXX Refactor this - make it an instance method of Subject rather than a
460
 
    # class method of Worksheet. Can't do that now because Subject isn't
461
 
    # linked referentially to the Worksheet.
462
 
    @classmethod
463
 
    def get_by_name(cls, store, subjectname, worksheetname):
464
 
        """
465
 
        Get the Worksheet from the db associated with a given store, subject
466
 
        name and worksheet name.
467
 
        """
468
 
        return store.find(cls, cls.subject == unicode(subjectname),
469
 
            cls.name == unicode(worksheetname)).one()
470
 
 
471
 
    def remove_all_exercises(self, store):
472
 
        """
473
 
        Remove all exercises from this worksheet.
474
 
        This does not delete the exercises themselves. It just removes them
475
 
        from the worksheet.
476
 
        """
477
 
        store.find(WorksheetExercise,
478
 
            WorksheetExercise.worksheet == self).remove()
479
 
            
480
 
    def get_permissions(self, user):
481
 
        return self.offering.get_permissions(user)
482
 
    
483
 
    def get_xml(self):
484
 
        """Returns the xml of this worksheet, converts from rst if required."""
485
 
        if self.format == u'rst':
486
 
            ws_xml = '<worksheet>' + rst(self.data) + '</worksheet>'
487
 
            return ws_xml
488
 
        else:
489
 
            return self.data
490
 
 
491
 
class WorksheetExercise(Storm):
492
 
    __storm_table__ = "worksheet_exercise"
493
 
    
494
 
    id = Int(primary=True, name="ws_ex_id")
495
 
 
496
 
    worksheet_id = Int(name="worksheetid")
497
 
    worksheet = Reference(worksheet_id, Worksheet.id)
498
 
    exercise_id = Unicode(name="exerciseid")
499
 
    exercise = Reference(exercise_id, Exercise.id)
500
 
    optional = Bool()
501
 
    active = Bool()
502
 
    seq_no = Int()
503
 
    
504
 
    saves = ReferenceSet(id, "ExerciseSave.ws_ex_id")
505
 
    attempts = ReferenceSet(id, "ExerciseAttempt.ws_ex_id")
506
 
 
507
 
    __init__ = _kwarg_init
508
 
 
509
 
    def __repr__(self):
510
 
        return "<%s %s in %s>" % (type(self).__name__, self.exercise.name,
511
 
                                  self.worksheet.identifier)
512
 
 
513
 
class ExerciseSave(Storm):
514
 
    """
515
 
    Represents a potential solution to an exercise that a user has submitted
516
 
    to the server for storage.
517
 
    A basic ExerciseSave is just the current saved text for this exercise for
518
 
    this user (doesn't count towards their attempts).
519
 
    ExerciseSave may be extended with additional semantics (such as
520
 
    ExerciseAttempt).
521
 
    """
522
 
    __storm_table__ = "exercise_save"
523
 
    __storm_primary__ = "ws_ex_id", "user_id"
524
 
 
525
 
    ws_ex_id = Int(name="ws_ex_id")
526
 
    worksheet_exercise = Reference(ws_ex_id, "WorksheetExercise.id")
527
 
 
528
 
    user_id = Int(name="loginid")
529
 
    user = Reference(user_id, User.id)
530
 
    date = DateTime()
531
 
    text = Unicode()
532
 
 
533
 
    __init__ = _kwarg_init
534
 
 
535
 
    def __repr__(self):
536
 
        return "<%s %s by %s at %s>" % (type(self).__name__,
537
 
            self.exercise.name, self.user.login, self.date.strftime("%c"))
538
 
 
539
 
class ExerciseAttempt(ExerciseSave):
540
 
    """
541
 
    An ExerciseAttempt is a special case of an ExerciseSave. Like an
542
 
    ExerciseSave, it constitutes exercise solution data that the user has
543
 
    submitted to the server for storage.
544
 
    In addition, it contains additional information about the submission.
545
 
    complete - True if this submission was successful, rendering this exercise
546
 
        complete for this user.
547
 
    active - True if this submission is "active" (usually true). Submissions
548
 
        may be de-activated by privileged users for special reasons, and then
549
 
        they won't count (either as a penalty or success), but will still be
550
 
        stored.
551
 
    """
552
 
    __storm_table__ = "exercise_attempt"
553
 
    __storm_primary__ = "ws_ex_id", "user_id", "date"
554
 
 
555
 
    # The "text" field is the same but has a different name in the DB table
556
 
    # for some reason.
557
 
    text = Unicode(name="attempt")
558
 
    complete = Bool()
559
 
    active = Bool()
560
 
    
561
 
    def get_permissions(self, user):
562
 
        return set(['view']) if user is self.user else set()
563
 
  
564
 
class TestSuite(Storm):
565
 
    """A Testsuite acts as a container for the test cases of an exercise."""
566
 
    __storm_table__ = "test_suite"
567
 
    __storm_primary__ = "exercise_id", "suiteid"
568
 
    
569
 
    suiteid = Int()
570
 
    exercise_id = Unicode(name="exerciseid")
571
 
    description = Unicode()
572
 
    seq_no = Int()
573
 
    function = Unicode()
574
 
    stdin = Unicode()
575
 
    exercise = Reference(exercise_id, Exercise.id)
576
 
    test_cases = ReferenceSet(suiteid, 'TestCase.suiteid', order_by="seq_no")
577
 
    variables = ReferenceSet(suiteid, 'TestSuiteVar.suiteid', order_by='arg_no')
578
 
 
579
 
class TestCase(Storm):
580
 
    """A TestCase is a member of a TestSuite.
581
 
    
582
 
    It contains the data necessary to check if an exercise is correct"""
583
 
    __storm_table__ = "test_case"
584
 
    __storm_primary__ = "testid", "suiteid"
585
 
    
586
 
    testid = Int()
587
 
    suiteid = Int()
588
 
    suite = Reference(suiteid, "TestSuite.suiteid")
589
 
    passmsg = Unicode()
590
 
    failmsg = Unicode()
591
 
    test_default = Unicode()
592
 
    seq_no = Int()
593
 
    
594
 
    parts = ReferenceSet(testid, "TestCasePart.testid")
595
 
    
596
 
    __init__ = _kwarg_init
597
 
 
598
 
class TestSuiteVar(Storm):
599
 
    """A container for the arguments of a Test Suite"""
600
 
    __storm_table__ = "suite_variable"
601
 
    __storm_primary__ = "varid"
602
 
    
603
 
    varid = Int()
604
 
    suiteid = Int()
605
 
    var_name = Unicode()
606
 
    var_value = Unicode()
607
 
    var_type = Unicode()
608
 
    arg_no = Int()
609
 
    
610
 
    suite = Reference(suiteid, "TestSuite.suiteid")
611
 
    
612
 
    __init__ = _kwarg_init
613
 
    
614
 
class TestCasePart(Storm):
615
 
    """A container for the test elements of a Test Case"""
616
 
    __storm_table__ = "test_case_part"
617
 
    __storm_primary__ = "partid"
618
 
    
619
 
    partid = Int()
620
 
    testid = Int()
621
 
    
622
 
    part_type = Unicode()
623
 
    test_type = Unicode()
624
 
    data = Unicode()
625
 
    filename = Unicode()
626
 
    
627
 
    test = Reference(testid, "TestCase.testid")
628
 
    
629
 
    __init__ = _kwarg_init