From 6c802f468df31684ee7ef065c2c4f6a35bbca53e Mon Sep 17 00:00:00 2001 From: Trevor McCasland Date: Fri, 2 Dec 2016 17:30:28 -0600 Subject: [PATCH] Add i18n tranlastion to common 3/5 This is patch 3 of 5 to use i18n translation. Custom Hacking rule will be introduced when these merge. Change-Id: I48f95b3c090e9b6f91185c14113daae5bc621d0b --- trove/common/xmlutils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trove/common/xmlutils.py b/trove/common/xmlutils.py index 1231a5902c..8f70bc50b2 100644 --- a/trove/common/xmlutils.py +++ b/trove/common/xmlutils.py @@ -17,6 +17,8 @@ from xml.parsers import expat from xml import sax from xml.sax import expatreader +from trove.common.i18n import _ + class ProtectedExpatParser(expatreader.ExpatParser): """An expat parser which disables DTD's and entities by default.""" @@ -29,21 +31,21 @@ class ProtectedExpatParser(expatreader.ExpatParser): self.forbid_entities = forbid_entities def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): - raise ValueError("Inline DTD forbidden") + raise ValueError(_("Inline DTD forbidden")) def entity_decl(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName): - raise ValueError(" entity declaration forbidden") + raise ValueError(_(" entity declaration forbidden")) def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 - raise ValueError(" unparsed entity forbidden") + raise ValueError(_(" unparsed entity forbidden")) def external_entity_ref(self, context, base, systemId, publicId): - raise ValueError(" external entity forbidden") + raise ValueError(_(" external entity forbidden")) def notation_decl(self, name, base, sysid, pubid): - raise ValueError(" notation forbidden") + raise ValueError(_(" notation forbidden")) def reset(self): expatreader.ExpatParser.reset(self)