[open-ils-commits] [GIT] Evergreen ILS branch master updated. c428b52fd33a231aac0959279c07a1188576bfd3

Evergreen Git git at git.evergreen-ils.org
Thu Feb 16 14:06:56 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  c428b52fd33a231aac0959279c07a1188576bfd3 (commit)
      from  bd0057b49bd7179bf71962eff64ce0029e1067e6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c428b52fd33a231aac0959279c07a1188576bfd3
Author: Dan Scott <dscott at laurentian.ca>
Date:   Thu Feb 16 12:49:54 2012 -0500

    Escape content when generating DTD for fieldmapper
    
    Noticed by Thomas Berezansky, if a translation in a PO or POT file
    contains an unescaped left angle bracket, a DTD will be generated that
    contains the unescaped left angle bracket - and that isn't valid.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>

diff --git a/build/i18n/scripts/fieldmapper.py b/build/i18n/scripts/fieldmapper.py
index 385fce5..51e5ba5 100755
--- a/build/i18n/scripts/fieldmapper.py
+++ b/build/i18n/scripts/fieldmapper.py
@@ -24,6 +24,7 @@ import polib
 import sys
 import xml.sax
 import xml.sax.handler
+import xml.sax.saxutils
 
 class IDL(basel10n.BaseL10N):
     """
@@ -64,14 +65,14 @@ class IDL(basel10n.BaseL10N):
         """
         Creates an entity definition file based on a translated PO file.
         """
-        entity = '<!ENTITY %s "%s">'
+        entity = '<!ENTITY %s %s>'
         for entry in self.pot:
             for name in entry.occurrences:
+                entdef = xml.sax.saxutils.quoteattr(entry.msgstr)
                 if entry.msgstr == '':
                     # No translation available; use the en-US definition
-                    self.definitions.append(entity % (name[0], entry.msgid))
-                else:
-                    self.definitions.append(entity % (name[0], entry.msgstr))
+                    entdef = xml.sax.saxutils.quoteattr(entry.msgid)
+                self.definitions.append(entity % (name[0], entdef))
 
 class IDLHandler(xml.sax.handler.ContentHandler):
     """
diff --git a/build/i18n/tests/data/testidl.ent b/build/i18n/tests/data/testidl.ent
index d1cfb57..effd5c5 100644
--- a/build/i18n/tests/data/testidl.ent
+++ b/build/i18n/tests/data/testidl.ent
@@ -11,7 +11,7 @@
 <!ENTITY class.auoi.label "venenatis, mi nisl">
 <!ENTITY field.rodcirc.recurring_fine_rule.label "suscipit sapien, eu sollicitudin">
 <!ENTITY field.rodcirc.duration_rule.label "neque dolor a nulla">
-<!ENTITY field.auoi.id.label "Phasellus aliquam vulputate justo">
+<!ENTITY field.auoi.id.label 'Phasellus " aliquam vulputate justo'>
 <!ENTITY field.rodcirc.payment_total.label "Proin augue libero">
 <!ENTITY field.rodcirc.phone_renewal.label "hendrerit pretium">
 <!ENTITY field.rodcirc.circ_lib.label "rutrum pretium">
@@ -37,6 +37,6 @@
 <!ENTITY field.auoi.opt_in_ts.label "sapien id velit nonummy">
 <!ENTITY field.rodcirc.desk_renewal.label "congue, neque">
 <!ENTITY field.rodcirc.target_copy.label "ut ullamcorper faucibus">
-<!ENTITY field.rodcirc.renewal_remaining.label "diam felis">
+<!ENTITY field.rodcirc.renewal_remaining.label "diam felis&lt;">
 <!ENTITY field.aws.owning_lib.label "Owning Library">
 <!ENTITY field.rodcirc.id.label "pulvinar augue">
diff --git a/build/i18n/tests/data/testidl.po b/build/i18n/tests/data/testidl.po
index 744cff4..ec4605b 100644
--- a/build/i18n/tests/data/testidl.po
+++ b/build/i18n/tests/data/testidl.po
@@ -65,7 +65,7 @@ msgstr "neque dolor a nulla"
 
 #: field.auoi.id.label:25
 msgid "Opt-in ID"
-msgstr "Phasellus aliquam vulputate justo"
+msgstr "Phasellus \" aliquam vulputate justo"
 
 #: field.rodcirc.payment_total.label:86
 msgid "Payment Totals"
@@ -165,7 +165,7 @@ msgstr "ut ullamcorper faucibus"
 
 #: field.rodcirc.renewal_remaining.label:74
 msgid "Remaining Renewals"
-msgstr "diam felis"
+msgstr "diam felis<"
 
 #: field.aws.owning_lib.label:46
 msgid "Owning Library"

-----------------------------------------------------------------------

Summary of changes:
 build/i18n/scripts/fieldmapper.py |    9 +++++----
 build/i18n/tests/data/testidl.ent |    4 ++--
 build/i18n/tests/data/testidl.po  |    4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list