Fixed a couple of little errors. updated a little piece of code.

svn: r16261
This commit is contained in:
Craig J. Anderson 2010-12-10 13:06:08 +00:00
parent 0a133f1f32
commit 74974570e6

View File

@ -827,8 +827,8 @@ class VariableParse(object):
def is_a(self): def is_a(self):
""" check """ """ check """
return self._in.this == "$" and \ return self._in.this == "$" and self._in.next is not None and \
"nsijbBdDmMvVauetT".find(self._in.next) != -1 "nsijbBdDmMvVauetT".find(self._in.next) != -1
def get_event_by_type(self, marrage, e_type): def get_event_by_type(self, marrage, e_type):
""" get an event from a type """ """ get an event from a type """
@ -901,8 +901,22 @@ class VariableParse(object):
def __parse_name(self, person): def __parse_name(self, person):
name_format = NameFormat(self._in) name_format = NameFormat(self._in)
name = name_format.get_name(person) name = name_format.get_name(person)
_out.add_variable( return name_format.parse_format(name)
name_format.parse_format(name))
def __parse_id(self, first_class_object):
if first_class_object:
return first_class_object.get_gramps_id()
else:
return ""
def __parse_event(self, person):
event = self.get_event_by_name(person, attrib_parse.get_name())
event_f = EventFormat(self.database, self._in)
if event:
return event_f.parse_format(event)
else:
event_f.parse_empty()
return ""
def parse_format(self, _out): def parse_format(self, _out):
"""Parse the $ variables. """ """Parse the $ variables. """
@ -915,25 +929,21 @@ class VariableParse(object):
if next_char == "n": if next_char == "n":
#Person's name #Person's name
self.__parse_name(self.friend.person) _out.add_variable(
self.__parse_name(self.friend.person))
elif next_char == "s": elif next_char == "s":
#Souses name #Souses name
self.__parse_name(self.friend.spouse) _out.add_variable(
self.__parse_name(self.friend.spouse))
elif next_char == "i": elif next_char == "i":
#Person's Id #Person's Id
if self.friend.person: _out.add_variable(
_out.level.add_display( self.__parse_id(self.friend.person))
self.friend.person.get_gramps_id())
else:
_out.level.add_remove()
elif next_char == "j": elif next_char == "j":
#Marriage Id #Marriage Id
if self.friend.family: _out.add_variable(
_out.level.add_display( self.__parse_id(self.friend.family))
self.friend.family.get_gramps_id())
else:
_out.level.add_remove()
elif next_char == "b": elif next_char == "b":
#Person's Birth date #Person's Birth date
@ -1005,24 +1015,12 @@ class VariableParse(object):
elif next_char == "e": elif next_char == "e":
#person event #person event
event = self.get_event_by_name(self.friend.person, _out.add_variable(
attrib_parse.get_name()) self.__parse_event(self.friend.person))
if event:
event_f = EventFormat(self.database, self._in)
_out.add_variable(event_f.parse_format(event))
else:
EventFormat(self.database, self._in).parse_empty()
_out.add_remove()
elif next_char == "t": elif next_char == "t":
#person event #person event
event = self.get_event_by_name(self.friend.family, _out.add_variable(
attrib_parse.get_name()) self.__parse_event(self.friend.family))
if event:
event_f = EventFormat(self.database)
_out.add_variable( event_f.parse_format(event))
else:
EventFormat(self.database, self._in).parse_empty()
_out.add_remove()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -1049,11 +1047,13 @@ class SubstKeywords(object):
self.database = database self.database = database
self.person = database.get_person_from_handle(person_handle) self.person = database.get_person_from_handle(person_handle)
self.spouse = None
self.family = None self.family = None
self.pointer = None self.spouse = None
self.line = None #Consumable_string - set below self.line = None #Consumable_string - set below
if self.person is None:
return
fam_hand_list = self.person.get_family_handle_list() fam_hand_list = self.person.get_family_handle_list()
if fam_hand_list: if fam_hand_list:
if family_handle in fam_hand_list: if family_handle in fam_hand_list: