2 # Functions for interacting with the address_types table in the database
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
10 from PLC.Parameter import Parameter
12 class AddressTypes(dict):
14 Representation of the address_types table in the database.
18 'address_type_id': Parameter(int, "Address type identifier"),
19 'name': Parameter(str, "Address type name"),
22 def __init__(self, api):
23 sql = "SELECT address_type_id, name FROM address_types"
25 for row in api.db.selectall(sql):
26 self[row['address_type_id']] = row['name']
27 self[row['name']] = row['address_type_id']