* 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 cf3b73f529
commit 4dcae32365
4 changed files with 26 additions and 10 deletions

View File

@ -1,6 +1,10 @@
2006-12-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/ArgHandler.py: Check recent file for existance before trying to
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>
* 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):
if not person:
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:
return name
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
if birth and use_markup and birth.get_type() != RelLib.EventType.BIRTH:
bdate = "<i>%s</i>" % DateHandler.get_date(birth)
bplace = "<i>%s</i>" % self.get_place_name(birth.get_place_handle())
bdate = "<i>%s</i>" % escape(DateHandler.get_date(birth))
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:
bdate = DateHandler.get_date(birth)
bplace = self.get_place_name(birth.get_place_handle())
@ -403,8 +409,11 @@ class FormattingHelper:
bplace = ""
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
if death and use_markup and death.get_type() != RelLib.EventType.DEATH:
ddate = "<i>%s</i>" % DateHandler.get_date(death)
dplace = "<i>%s</i>" % self.get_place_name(death.get_place_handle())
ddate = "<i>%s</i>" % escape(DateHandler.get_date(death))
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:
ddate = DateHandler.get_date(death)
dplace = self.get_place_name(death.get_place_handle())

View File

@ -871,7 +871,7 @@ class RelationshipView(PageView.PersonNavView):
pass
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))
def place_name(self, handle):

View File

@ -1173,9 +1173,12 @@ class TestcaseGenerator(Tool.Tool):
o.add_media_reference( self.fill_object( RelLib.MediaRef()))
if isinstance(o,RelLib.MediaObject):
o.set_description( self.rand_text(self.SHORT))
o.set_path("/tmp/TestcaseGenerator.png")
o.set_mime_type("image/png")
if randint(0,3) == 1:
o.set_description( self.rand_text(self.LONG))
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 not self.generated_media or randint(0,10) == 1:
@ -1269,7 +1272,7 @@ class TestcaseGenerator(Tool.Tool):
o.add_url(u)
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_type( self.rand_type(RelLib.UrlType()))