1 | ## |
---|
2 | ## interfaces.py |
---|
3 | ## Login : <uli@pu.smp.net> |
---|
4 | ## Started on Sun Jan 16 15:30:01 2011 Uli Fouquet |
---|
5 | ## $Id$ |
---|
6 | ## |
---|
7 | ## Copyright (C) 2011 Uli Fouquet |
---|
8 | ## This program is free software; you can redistribute it and/or modify |
---|
9 | ## it under the terms of the GNU General Public License as published by |
---|
10 | ## the Free Software Foundation; either version 2 of the License, or |
---|
11 | ## (at your option) any later version. |
---|
12 | ## |
---|
13 | ## This program is distributed in the hope that it will be useful, |
---|
14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | ## GNU General Public License for more details. |
---|
17 | ## |
---|
18 | ## You should have received a copy of the GNU General Public License |
---|
19 | ## along with this program; if not, write to the Free Software |
---|
20 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
21 | ## |
---|
22 | """Interfaces regarding student applications and related components. |
---|
23 | """ |
---|
24 | from zope import schema |
---|
25 | from waeup.sirp.interfaces import IWAeUPObject |
---|
26 | |
---|
27 | class IApplicationsRoot(IWAeUPObject): |
---|
28 | """A container for student application containers. |
---|
29 | """ |
---|
30 | def addApplicationContainer(container, name=None): |
---|
31 | """Add an application container. |
---|
32 | |
---|
33 | Adds an application container that implements `interface` |
---|
34 | under the name `name`. |
---|
35 | |
---|
36 | `container` the container instance to be added. Should |
---|
37 | implement :class:`IApplicationContainer`. |
---|
38 | |
---|
39 | `name` |
---|
40 | the name under which the container will be accessible. We |
---|
41 | usually use names like ``pume_2011`` to indicate, that the |
---|
42 | new container will contain student applications for a |
---|
43 | certain screening type (``pume``) and of the year 2011. |
---|
44 | """ |
---|
45 | |
---|
46 | class IApplicationContainer(IWAeUPObject): |
---|
47 | """An application container contains student applications. |
---|
48 | |
---|
49 | """ |
---|
50 | id = schema.TextLine( |
---|
51 | title = u'Internal ID', |
---|
52 | required = True, |
---|
53 | ) |
---|
54 | |
---|
55 | title = schema.TextLine( |
---|
56 | title = u'Short description of the type of applications stored here.', |
---|
57 | required = True, |
---|
58 | default = u'Untitled', |
---|
59 | ) |
---|
60 | |
---|
61 | description = schema.Text( |
---|
62 | title = u'Human readable description in reST format', |
---|
63 | required = False, |
---|
64 | default = u'Not set.' |
---|
65 | ) |
---|
66 | |
---|
67 | startdate = schema.Date( |
---|
68 | title = u'Date when the application period starts', |
---|
69 | required = False, |
---|
70 | default = None, |
---|
71 | ) |
---|
72 | |
---|
73 | enddate = schema.Date( |
---|
74 | title = u'Date when the application period ends', |
---|
75 | required = False, |
---|
76 | default = None, |
---|
77 | ) |
---|
78 | |
---|
79 | strict_deadline = schema.Bool( |
---|
80 | title = u'Forbid additions after deadline (enddate)', |
---|
81 | required = True, |
---|
82 | default = True, |
---|
83 | ) |
---|
84 | |
---|
85 | def archive(id=None): |
---|
86 | """Create on-dist archive of applications stored in this term. |
---|
87 | |
---|
88 | If id is `None`, all applications are archived. |
---|
89 | |
---|
90 | If id contains a single id string, only the respective |
---|
91 | applications are archived. |
---|
92 | |
---|
93 | If id contains a list of id strings all of the respective |
---|
94 | application types are saved to disk. |
---|
95 | """ |
---|
96 | |
---|
97 | def clear(id=None, archive=True): |
---|
98 | """Remove applications of type given by 'id'. |
---|
99 | |
---|
100 | Optionally archive the applications. |
---|
101 | |
---|
102 | If id is `None`, all applications are archived. |
---|
103 | |
---|
104 | If id contains a single id string, only the respective |
---|
105 | applications are archived. |
---|
106 | |
---|
107 | If id contains a list of id strings all of the respective |
---|
108 | application types are saved to disk. |
---|
109 | |
---|
110 | If `archive` is ``False`` none of the archive-handling is done |
---|
111 | and respective applications are simply removed from the |
---|
112 | database. |
---|
113 | """ |
---|