X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FKeys.py;h=8d22dc2e93fd13cb55b04fd3b74422bfcd329094;hb=refs%2Fheads%2Fplanetlab-4_0-branch;hp=86569fc7ba47b1a280afe53429ae30e54216079b;hpb=881cc051f8c3e51211f33e74f22de9dbaf33348b;p=plcapi.git diff --git a/PLC/Keys.py b/PLC/Keys.py index 86569fc..8d22dc2 100644 --- a/PLC/Keys.py +++ b/PLC/Keys.py @@ -93,7 +93,7 @@ class Key(Row): " WHERE key_id IN (%s)" % ", ".join(map(str, key_ids))) # But disassociate them from all join tables - for table in ['person_key']: + for table in self.join_tables: self.api.db.do("DELETE FROM %s WHERE key_id IN (%s)" % \ (table, ", ".join(map(str, key_ids)))) @@ -106,22 +106,17 @@ class Keys(Table): database. """ - def __init__(self, api, key_filter = None, columns = None, peer_id = None): + def __init__(self, api, key_filter = None, columns = None): Table.__init__(self, api, Key, columns) sql = "SELECT %s FROM view_keys WHERE is_blacklisted IS False" % \ ", ".join(self.columns) - if peer_id is None: - sql += " AND peer_id IS NULL" - elif isinstance(peer_id, (int, long)): - sql += " AND peer_id = %d" % peer_id - if key_filter is not None: if isinstance(key_filter, (list, tuple, set)): key_filter = Filter(Key.fields, {'key_id': key_filter}) elif isinstance(key_filter, dict): key_filter = Filter(Key.fields, key_filter) - sql += " AND (%s)" % key_filter.sql(api) + sql += " AND (%s) %s" % key_filter.sql(api) self.selectall(sql)