" 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))))
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})