Revert 10874 changes to base.py and _FilterParser.py

svn: r10877
This commit is contained in:
Gerald Britton 2008-07-18 13:15:15 +00:00
parent 0cabb9161c
commit 437bde6e5c
3 changed files with 14 additions and 14 deletions

View File

@ -66,7 +66,7 @@ class FilterParser(handler.ContentHandler):
elif tag == "filter": elif tag == "filter":
self.f = GenericFilterFactory(self.namespace)() self.f = GenericFilterFactory(self.namespace)()
self.f.set_name(attrs['name']) self.f.set_name(attrs['name'])
if 'function' in attrs: if attrs.has_key('function'):
try: try:
if int(attrs['function']): if int(attrs['function']):
op = 'or' op = 'or'
@ -75,9 +75,9 @@ class FilterParser(handler.ContentHandler):
except ValueError: except ValueError:
op = attrs['function'] op = attrs['function']
self.f.set_logical_op(op) self.f.set_logical_op(op)
if 'invert' in attrs: if attrs.has_key('invert'):
self.f.set_invert(attrs['invert']) self.f.set_invert(attrs['invert'])
if 'comment' in attrs: if attrs.has_key('comment'):
self.f.set_comment(attrs['comment']) self.f.set_comment(attrs['comment'])
self.gfilter_list.add(self.namespace, self.f) self.gfilter_list.add(self.namespace, self.f)
elif tag == "rule": elif tag == "rule":

View File

@ -650,7 +650,7 @@ class GrampsDbBase(Callback):
person ID prefix. person ID prefix.
""" """
index = self.person_prefix % self.pmap_index 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 self.pmap_index += 1
index = self.person_prefix % self.pmap_index index = self.person_prefix % self.pmap_index
self.pmap_index += 1 self.pmap_index += 1
@ -662,7 +662,7 @@ class GrampsDbBase(Callback):
place ID prefix. place ID prefix.
""" """
index = self.place_prefix % self.lmap_index 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 self.lmap_index += 1
index = self.place_prefix % self.lmap_index index = self.place_prefix % self.lmap_index
self.lmap_index += 1 self.lmap_index += 1
@ -674,7 +674,7 @@ class GrampsDbBase(Callback):
event ID prefix. event ID prefix.
""" """
index = self.event_prefix % self.emap_index 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 self.emap_index += 1
index = self.event_prefix % self.emap_index index = self.event_prefix % self.emap_index
self.emap_index += 1 self.emap_index += 1
@ -686,7 +686,7 @@ class GrampsDbBase(Callback):
off the media object ID prefix. off the media object ID prefix.
""" """
index = self.mediaobject_prefix % self.omap_index 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 self.omap_index += 1
index = self.mediaobject_prefix % self.omap_index index = self.mediaobject_prefix % self.omap_index
self.omap_index += 1 self.omap_index += 1
@ -698,7 +698,7 @@ class GrampsDbBase(Callback):
source ID prefix. source ID prefix.
""" """
index = self.source_prefix % self.smap_index 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 self.smap_index += 1
index = self.source_prefix % self.smap_index index = self.source_prefix % self.smap_index
self.smap_index += 1 self.smap_index += 1
@ -710,7 +710,7 @@ class GrampsDbBase(Callback):
family ID prefix. family ID prefix.
""" """
index = self.family_prefix % self.fmap_index 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 self.fmap_index += 1
index = self.family_prefix % self.fmap_index index = self.family_prefix % self.fmap_index
self.fmap_index += 1 self.fmap_index += 1
@ -722,7 +722,7 @@ class GrampsDbBase(Callback):
off the repository ID prefix. off the repository ID prefix.
""" """
index = self.repository_prefix % self.rmap_index 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 self.rmap_index += 1
index = self.repository_prefix % self.rmap_index index = self.repository_prefix % self.rmap_index
self.rmap_index += 1 self.rmap_index += 1
@ -734,7 +734,7 @@ class GrampsDbBase(Callback):
note ID prefix. note ID prefix.
""" """
index = self.note_prefix % self.nmap_index 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 self.nmap_index += 1
index = self.note_prefix % self.nmap_index index = self.note_prefix % self.nmap_index
self.nmap_index += 1 self.nmap_index += 1
@ -1483,7 +1483,8 @@ class GrampsDbBase(Callback):
} }
table = key2table[obj_key] 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): def find_initial_person(self):
person = self.get_default_person() person = self.get_default_person()

View File

@ -930,7 +930,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
# from the primary object 'obj' or any of its secondary objects. # from the primary object 'obj' or any of its secondary objects.
handle = obj.handle handle = obj.handle
update = str(handle) in self.reference_map_primary_map update = self.reference_map_primary_map.has_key(str(handle))
if update: if update:
# First thing to do is get hold of all rows in the reference_map # 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): def __get_obj_from_gramps_id(self, val, tbl, class_init, prim_tbl):
try: try:
if tbl.has_key(str(val)): if tbl.has_key(str(val)):
#if str(val) in tbl:
data = tbl.get(str(val), txn=self.txn) data = tbl.get(str(val), txn=self.txn)
obj = class_init() obj = class_init()
### FIXME: this is a dirty hack that works without no ### FIXME: this is a dirty hack that works without no