From c69d90e2ad6decdb72294a30fe44aea33cde4338 Mon Sep 17 00:00:00 2001
From: Tony Mack <tmack@paris.CS.Princeton.EDU>
Date: Fri, 28 Sep 2012 15:09:39 -0400
Subject: [PATCH] initial checkin

---
 AddressAddressTypes.py | 51 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 AddressAddressTypes.py

diff --git a/AddressAddressTypes.py b/AddressAddressTypes.py
new file mode 100644
index 00000000..7f51ffff
--- /dev/null
+++ b/AddressAddressTypes.py
@@ -0,0 +1,51 @@
+#
+# Functions for interacting with the address_types table in the database
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+
+from types import StringTypes
+from PLC.Faults import *
+from PLC.Parameter import Parameter
+from PLC.Filter import Filter
+from PLC.Storage.AlchemyObj import AlchemyObj
+from PLC.Table import Row, Table
+
+class AddressAddressType(AlchemyObj):
+    """
+    Representation of a row in the address_types table. To use,
+    instantiate with a dict of values.
+    """
+
+    tablename = 'address_types'
+    join_tables = ['address_address_type']
+    fields = {
+        'address_id': Parameter(int, "Address identifier"),
+        'address_type_id': Parameter(int, "Address type identifier"),
+        }
+
+
+    def sync(self, insert=False, validate=True):
+        AlchemyObj.sync(self, insert, validate):
+        AlchemyObj.insert(self, dict(self))
+
+
+    def delete(self, commit=True):
+        AlchemyObj.delete(self, dict(self))
+
+class AddressAddressTypes(list):
+    """
+    Representation of the address_types table in the database.
+    """
+
+    def __init__(self, api, filter = None, columns = None):
+        if not filter:
+            address_types = AddressAddressType().select()
+        elif isinstance(address_type_filter, dict):
+            address_types = AddressAddressType().select(filter=filter)
+        else:
+            raise PLCInvalidArgument, "Wrong address address_type filter %r"filter
+
+        for address_type in address_types:
+            self.append(address_type) 
-- 
2.47.0