Initial checkin of new API implementation
[plcapi.git] / PLC / Addresses.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 Address(Row):
9     """
10     Representation of a row in the addresses table. To use, instantiate
11     with a dict of values.
12     """
13
14     fields = {
15         'address_id': Parameter(int, "Address type"),
16         'address_type_id': Parameter(int, "Address type identifier"),
17         'address_type': Parameter(str, "Address type name"),
18         'line1': Parameter(str, "Address line 1"),
19         'line2': Parameter(str, "Address line 2"),
20         'line3': Parameter(str, "Address line 3"),
21         'city': Parameter(str, "City"),
22         'state': Parameter(str, "State or province"),
23         'postalcode': Parameter(str, "Postal code"),
24         'country': Parameter(str, "Country"),
25         }
26
27     def __init__(self, api, fields):
28         self.api = api
29         dict.__init__(fields)
30
31     def flush(self, commit = True):
32         # XXX
33         pass
34
35     def delete(self, commit = True):
36         # XXX
37         pass
38
39 class Addresses(Table):
40     """
41     Representation of row(s) from the addresses table in the
42     database.
43     """
44
45     def __init__(self, api, address_id_list = None):
46         # XXX
47         pass