Merge remote-tracking branch 'origin/pycurl' into planetlab-4_0-branch
[plcapi.git] / PLC / PCUs.py
index 2bace8b..0ab56cc 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: PCUs.py,v 1.8 2006/11/08 23:00:00 mlhuang Exp $
+# $Id: PCUs.py 5574 2007-10-25 20:33:17Z thierry $
 #
 
 from PLC.Faults import *
@@ -100,17 +100,17 @@ class PCUs(Table):
     database.
     """
 
-    def __init__(self, api, pcu_filter = None):
-        Table.__init__(self, api, PCU)
+    def __init__(self, api, pcu_filter = None, columns = None):
+        Table.__init__(self, api, PCU, columns)
 
         sql = "SELECT %s FROM view_pcus WHERE True" % \
-              ", ".join(PCU.fields)
+              ", ".join(self.columns)
 
         if pcu_filter is not None:
             if isinstance(pcu_filter, (list, tuple, set)):
                 pcu_filter = Filter(PCU.fields, {'pcu_id': pcu_filter})
             elif isinstance(pcu_filter, dict):
                 pcu_filter = Filter(PCU.fields, pcu_filter)
-            sql += " AND (%s)" % pcu_filter.sql(api)
+            sql += " AND (%s) %s" % pcu_filter.sql(api)
 
         self.selectall(sql)