diff --git a/ChangeLog b/ChangeLog index 36e2f6d0d..ac6c372e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 2006-12-12 Martin Hawlisch * 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 * src/Editors/_EditMedia.py: fix menu title (bug#755) diff --git a/src/DataViews/_PedigreeView.py b/src/DataViews/_PedigreeView.py index 3a6ad9db2..07896be82 100644 --- a/src/DataViews/_PedigreeView.py +++ b/src/DataViews/_PedigreeView.py @@ -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 = "%s" % DateHandler.get_date(birth) - bplace = "%s" % self.get_place_name(birth.get_place_handle()) + bdate = "%s" % escape(DateHandler.get_date(birth)) + bplace = "%s" % 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 = "%s" % DateHandler.get_date(death) - dplace = "%s" % self.get_place_name(death.get_place_handle()) + ddate = "%s" % escape(DateHandler.get_date(death)) + dplace = "%s" % 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()) diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index 508ab0143..d889d58d9 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -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): diff --git a/src/plugins/TestcaseGenerator.py b/src/plugins/TestcaseGenerator.py index 360877fdd..a5249afe8 100644 --- a/src/plugins/TestcaseGenerator.py +++ b/src/plugins/TestcaseGenerator.py @@ -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()))