Initial checkin of new API implementation
[plcapi.git] / PLC / Keys.py
1 from types import StringTypes
2
3 from PLC.Faults import *
4 from PLC.Parameter import Parameter
5 from PLC.Debug import profile
6 from PLC.Table import Row, Table
7
8 class Key(Row):
9     """
10     Representation of a row in the keys table. To use, instantiate
11     with a dict of values.
12     """
13
14     fields = {
15         'key_id': Parameter(int, "Key type"),
16         'key_type': Parameter(str, "Key type"),
17         'key': Parameter(str, "Key value"),
18         'last_updated': Parameter(str, "Date and time of last update"),
19         'is_blacklisted': Parameter(str, "Key has been blacklisted and is forever unusable"),
20         }
21
22     def __init__(self, api, fields):
23         self.api = api
24         dict.__init__(fields)
25
26     def commit(self):
27         # XXX
28         pass
29
30     def delete(self):
31         # XXX
32         pass
33
34 class Keys(Table):
35     """
36     Representation of row(s) from the keys table in the
37     database.
38     """
39
40     def __init__(self, api, key_id_list = None):
41         # XXX
42         pass