* src/DataViews/_RelationView.py: Escape XML special chars

* src/DataViews/_PedigreeView.py: Escape XML special chars
* src/plugins/TestcaseGenerator.py: Create media note object; Randomize URL



svn: r7787
This commit is contained in:
Martin Hawlisch 2006-12-12 11:49:57 +00:00
parent c72278515b
commit ea86f9870b
4 changed files with 26 additions and 10 deletions

View File

@ -1,6 +1,10 @@
2006-12-12 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2006-12-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/ArgHandler.py: Check recent file for existance before trying to * src/ArgHandler.py: Check recent file for existance before trying to
load that file. (bug #447) load that file. (bug #447)
* src/DataViews/_RelationView.py: Escape XML special chars
* src/DataViews/_PedigreeView.py: Escape XML special chars
* src/plugins/TestcaseGenerator.py: Create media note object;
Randomize URL
2006-12-11 Don Allingham <don@gramps-project.org> 2006-12-11 Don Allingham <don@gramps-project.org>
* src/Editors/_EditMedia.py: fix menu title (bug#755) * src/Editors/_EditMedia.py: fix menu title (bug#755)

View File

@ -387,14 +387,20 @@ class FormattingHelper:
def format_person( self, person, line_count, use_markup=False): def format_person( self, person, line_count, use_markup=False):
if not person: if not person:
return "" return ""
name = NameDisplay.displayer.display(person) if use_markup:
name = escape(NameDisplay.displayer.display(person))
else:
name = NameDisplay.displayer.display(person)
if line_count < 3: if line_count < 3:
return name return name
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person) birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
if birth and use_markup and birth.get_type() != RelLib.EventType.BIRTH: if birth and use_markup and birth.get_type() != RelLib.EventType.BIRTH:
bdate = "<i>%s</i>" % DateHandler.get_date(birth) bdate = "<i>%s</i>" % escape(DateHandler.get_date(birth))
bplace = "<i>%s</i>" % self.get_place_name(birth.get_place_handle()) bplace = "<i>%s</i>" % escape(self.get_place_name(birth.get_place_handle()))
elif birth and use_markup:
bdate = escape(DateHandler.get_date(birth))
bplace = escape(self.get_place_name(birth.get_place_handle()))
elif birth: elif birth:
bdate = DateHandler.get_date(birth) bdate = DateHandler.get_date(birth)
bplace = self.get_place_name(birth.get_place_handle()) bplace = self.get_place_name(birth.get_place_handle())
@ -403,8 +409,11 @@ class FormattingHelper:
bplace = "" bplace = ""
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person) death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
if death and use_markup and death.get_type() != RelLib.EventType.DEATH: if death and use_markup and death.get_type() != RelLib.EventType.DEATH:
ddate = "<i>%s</i>" % DateHandler.get_date(death) ddate = "<i>%s</i>" % escape(DateHandler.get_date(death))
dplace = "<i>%s</i>" % self.get_place_name(death.get_place_handle()) dplace = "<i>%s</i>" % escape(self.get_place_name(death.get_place_handle()))
elif death and use_markup:
ddate = escape(DateHandler.get_date(death))
dplace = escape(self.get_place_name(death.get_place_handle()))
elif death: elif death:
ddate = DateHandler.get_date(death) ddate = DateHandler.get_date(death)
dplace = self.get_place_name(death.get_place_handle()) dplace = self.get_place_name(death.get_place_handle())

View File

@ -871,7 +871,7 @@ class RelationshipView(PageView.PersonNavView):
pass pass
def write_relationship(self, box, family): def write_relationship(self, box, family):
msg = _('Relationship type: %s') % str(family.get_relationship()) msg = _('Relationship type: %s') % cgi.escape(str(family.get_relationship()))
box.add(GrampsWidgets.MarkupLabel(msg)) box.add(GrampsWidgets.MarkupLabel(msg))
def place_name(self, handle): def place_name(self, handle):

View File

@ -1173,9 +1173,12 @@ class TestcaseGenerator(Tool.Tool):
o.add_media_reference( self.fill_object( RelLib.MediaRef())) o.add_media_reference( self.fill_object( RelLib.MediaRef()))
if isinstance(o,RelLib.MediaObject): if isinstance(o,RelLib.MediaObject):
o.set_description( self.rand_text(self.SHORT)) if randint(0,3) == 1:
o.set_path("/tmp/TestcaseGenerator.png") o.set_description( self.rand_text(self.LONG))
o.set_mime_type("image/png") else:
o.set_description( self.rand_text(self.SHORT))
o.set_path("/tmp/TestcaseGenerator.png")
o.set_mime_type("image/png")
if isinstance(o,RelLib.MediaRef): if isinstance(o,RelLib.MediaRef):
if not self.generated_media or randint(0,10) == 1: if not self.generated_media or randint(0,10) == 1:
@ -1269,7 +1272,7 @@ class TestcaseGenerator(Tool.Tool):
o.add_url(u) o.add_url(u)
if isinstance(o,RelLib.Url): if isinstance(o,RelLib.Url):
o.set_path("http://www.gramps-project.org/") o.set_path("http://www.gramps-project.org/?test=%s" % self.rand_text(self.SHORT))
o.set_description( self.rand_text(self.SHORT)) o.set_description( self.rand_text(self.SHORT))
o.set_type( self.rand_type(RelLib.UrlType())) o.set_type( self.rand_type(RelLib.UrlType()))