1 | ## |
---|
2 | ## interfaces.py |
---|
3 | ## Login : <uli@pu.smp.net> |
---|
4 | ## Started on Sun Jun 27 11:06:23 2010 Uli Fouquet |
---|
5 | ## $Id$ |
---|
6 | ## |
---|
7 | ## Copyright (C) 2010 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 for JAMB data tables and related components. |
---|
23 | """ |
---|
24 | from waeup.sirp.interfaces import IWAeUPObject |
---|
25 | from zope.interface import Interface |
---|
26 | from zope import schema |
---|
27 | |
---|
28 | class IJAMBDataTable(IWAeUPObject): |
---|
29 | """A table containing JAMB data. |
---|
30 | """ |
---|
31 | import_datetime = schema.Datetime( |
---|
32 | title = u'Datetime of import of contained data.', |
---|
33 | required = False, |
---|
34 | ) |
---|
35 | |
---|
36 | importer_username = schema.TextLine( |
---|
37 | title = u'Name of user who initiated import.', |
---|
38 | required = False, |
---|
39 | ) |
---|
40 | |
---|
41 | def __iter__(): |
---|
42 | """An iterator over all data elements. |
---|
43 | """ |
---|
44 | |
---|
45 | def keys(): |
---|
46 | """Get iterator over all registration numbers of data. |
---|
47 | """ |
---|
48 | |
---|
49 | def items(): |
---|
50 | """Get iterator over tuples of registration numbers and datasets. |
---|
51 | """ |
---|
52 | |
---|
53 | def clear(): |
---|
54 | """Clear all data contained. |
---|
55 | |
---|
56 | This will also erase any import data. |
---|
57 | """ |
---|
58 | |
---|
59 | def importFromCSV(filepath, username=None): |
---|
60 | """Import data from filepath. |
---|
61 | |
---|
62 | `filepath` - the path to the CSV file to import data from. |
---|
63 | |
---|
64 | `username` - the (optional) username of the importing person. |
---|
65 | """ |
---|