commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9386 - trunk/gnue-common/src/definitions


From: reinhard
Subject: [gnue] r9386 - trunk/gnue-common/src/definitions
Date: Tue, 20 Feb 2007 12:49:53 -0600 (CST)

Author: reinhard
Date: 2007-02-20 12:49:52 -0600 (Tue, 20 Feb 2007)
New Revision: 9386

Modified:
   trunk/gnue-common/src/definitions/GParser.py
Log:
Added option to ignore minimum requirements when parsing an XML file, this is
helpful to merge in partial files (like translations).


Modified: trunk/gnue-common/src/definitions/GParser.py
===================================================================
--- trunk/gnue-common/src/definitions/GParser.py        2007-02-14 14:22:19 UTC 
(rev 9385)
+++ trunk/gnue-common/src/definitions/GParser.py        2007-02-20 18:49:52 UTC 
(rev 9386)
@@ -93,7 +93,8 @@
 # -----------------------------------------------------------------------------
 
 def loadXMLObject (stream, handler, rootType, xmlFileType,
-    initialize = True, attributes = {}, initParameters = {}, url = None):
+    initialize = True, attributes = {}, initParameters = {}, url = None,
+    checkRequired = True):
   """
   This method loads an object from a XML stream and returns that object.  If
   initialize is True (default), then the object is initialized and ready to go.
@@ -129,6 +130,7 @@
     url = hasattr (stream, 'url') and stream.url or '[unknown]'
 
   dh.url = url
+  dh.checkRequired = checkRequired
   dh.parser = parser
 
   dh.initValidation ()
@@ -250,6 +252,7 @@
     self.root            = None
     self.url             = None
     self.doImportLayoutParser = True
+    self.checkRequired   = True
 
     self._phaseInitCount     = 0
     self._requiredTags       = []
@@ -466,7 +469,7 @@
               lattrs[attr] = value = typecast (attrdata['Default'])
 
             # Check for missing required attributes
-            elif attrdata.get('Required', False):
+            elif self.checkRequired and attrdata.get('Required', False):
               tm = u_('Error processing <%(tagname)s> tag [required attribute '
                       '"%(attribute)s" not present]') \
                    % {'tagname': tname, 'attribute': attr}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]