diff --git a/src/Filters/_FilterParser.py b/src/Filters/_FilterParser.py index 4a1f19b9a..44ddce4d6 100644 --- a/src/Filters/_FilterParser.py +++ b/src/Filters/_FilterParser.py @@ -66,7 +66,7 @@ class FilterParser(handler.ContentHandler): elif tag == "filter": self.f = GenericFilterFactory(self.namespace)() self.f.set_name(attrs['name']) - if 'function' in attrs: + if attrs.has_key('function'): try: if int(attrs['function']): op = 'or' @@ -75,9 +75,9 @@ class FilterParser(handler.ContentHandler): except ValueError: op = attrs['function'] self.f.set_logical_op(op) - if 'invert' in attrs: + if attrs.has_key('invert'): self.f.set_invert(attrs['invert']) - if 'comment' in attrs: + if attrs.has_key('comment'): self.f.set_comment(attrs['comment']) self.gfilter_list.add(self.namespace, self.f) elif tag == "rule": diff --git a/src/gen/db/base.py b/src/gen/db/base.py index 5a4467c61..298437cb7 100644 --- a/src/gen/db/base.py +++ b/src/gen/db/base.py @@ -650,7 +650,7 @@ class GrampsDbBase(Callback): person ID prefix. """ index = self.person_prefix % self.pmap_index - while str(index) in self.id_trans: + while self.id_trans.has_key(str(index)): self.pmap_index += 1 index = self.person_prefix % self.pmap_index self.pmap_index += 1 @@ -662,7 +662,7 @@ class GrampsDbBase(Callback): place ID prefix. """ index = self.place_prefix % self.lmap_index - while str(index) in self.pid_trans: + while self.pid_trans.has_key(str(index)): self.lmap_index += 1 index = self.place_prefix % self.lmap_index self.lmap_index += 1 @@ -674,7 +674,7 @@ class GrampsDbBase(Callback): event ID prefix. """ index = self.event_prefix % self.emap_index - while str(index) in self.eid_trans: + while self.eid_trans.has_key(str(index)): self.emap_index += 1 index = self.event_prefix % self.emap_index self.emap_index += 1 @@ -686,7 +686,7 @@ class GrampsDbBase(Callback): off the media object ID prefix. """ index = self.mediaobject_prefix % self.omap_index - while str(index) in self.oid_trans: + while self.oid_trans.has_key(str(index)): self.omap_index += 1 index = self.mediaobject_prefix % self.omap_index self.omap_index += 1 @@ -698,7 +698,7 @@ class GrampsDbBase(Callback): source ID prefix. """ index = self.source_prefix % self.smap_index - while str(index) in self.sid_trans: + while self.sid_trans.has_key(str(index)): self.smap_index += 1 index = self.source_prefix % self.smap_index self.smap_index += 1 @@ -710,7 +710,7 @@ class GrampsDbBase(Callback): family ID prefix. """ index = self.family_prefix % self.fmap_index - while str(index) in self.fid_trans: + while self.fid_trans.has_key(str(index)): self.fmap_index += 1 index = self.family_prefix % self.fmap_index self.fmap_index += 1 @@ -722,7 +722,7 @@ class GrampsDbBase(Callback): off the repository ID prefix. """ index = self.repository_prefix % self.rmap_index - while str(index) in self.rid_trans: + while self.rid_trans.has_key(str(index)): self.rmap_index += 1 index = self.repository_prefix % self.rmap_index self.rmap_index += 1 @@ -734,7 +734,7 @@ class GrampsDbBase(Callback): note ID prefix. """ index = self.note_prefix % self.nmap_index - while str(index) in self.nid_trans: + while self.nid_trans.has_key(str(index)): self.nmap_index += 1 index = self.note_prefix % self.nmap_index self.nmap_index += 1 @@ -1483,7 +1483,8 @@ class GrampsDbBase(Callback): } table = key2table[obj_key] - return str(gramps_id) in table + #return str(gramps_id) in table + return table.has_key(str(gramps_id)) def find_initial_person(self): person = self.get_default_person() diff --git a/src/gen/db/dbdir.py b/src/gen/db/dbdir.py index bf556aeb5..6d3f50488 100644 --- a/src/gen/db/dbdir.py +++ b/src/gen/db/dbdir.py @@ -930,7 +930,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): # from the primary object 'obj' or any of its secondary objects. handle = obj.handle - update = str(handle) in self.reference_map_primary_map + update = self.reference_map_primary_map.has_key(str(handle)) if update: # First thing to do is get hold of all rows in the reference_map @@ -1374,7 +1374,6 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): def __get_obj_from_gramps_id(self, val, tbl, class_init, prim_tbl): try: if tbl.has_key(str(val)): - #if str(val) in tbl: data = tbl.get(str(val), txn=self.txn) obj = class_init() ### FIXME: this is a dirty hack that works without no