diff --git a/README.rst b/README.rst index 89eef6de68fe146867ac39c9553448f50f0ee0c0..6183e7ff134286daca9ff6e96c55778f5423573c 100644 --- a/README.rst +++ b/README.rst @@ -141,7 +141,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- -Version 2.29.6 (01/22/2017) +Version 2.29.7 (02/05/2018) + +- Fix for unicode error that occurs during simpleType validation + under Python 2.7. Thanks to Juha Tuomala for reporting this issue. +- Added a test for xs:simpleType validation that uses a pattern + containing a multi-byte character. + +Version 2.29.6 (01/22/2018) - Fix to generation of namespace prefix in export methods. With this fix, process_includes.py collects information about which @@ -151,7 +158,7 @@ Version 2.29.6 (01/22/2017) Calvert for identifying this problem and for helping me to understand it. -Version 2.29.5 (01/17/2017) +Version 2.29.5 (01/17/2018) - Fix to prevent infinite recursion that happens when a simple type is defined whose name is the same as it's restriction base type diff --git a/generateDS.html b/generateDS.html index a94408a5fc002dc55fe5c233c7b66737e9400f90..38fc6cc8b5072e44f2f60c7c4d81519ec5eee652 100644 --- a/generateDS.html +++ b/generateDS.html @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.6</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.7</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">January 26, 2018</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">February 05, 2018</td> </tr> </tbody> </table> @@ -3380,7 +3380,7 @@ following among others:</p> <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateDS.txt">View document source</a>. -Generated on: 2018-01-27 00:06 UTC. +Generated on: 2018-02-05 22:01 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateDS.py b/generateDS.py index b29c78dcb5590ed455cadd827bce7ec730a2b028..b68e94707873d0c7204f9eb5923c19ffcbf46d5e 100755 --- a/generateDS.py +++ b/generateDS.py @@ -229,7 +229,7 @@ logging.disable(logging.INFO) # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.29.6' +VERSION = '2.29.7' ##VERSION## BaseStrTypes = six.string_types @@ -2812,8 +2812,11 @@ def generateExportFn(wrt, prefix, element, namespace, nameSpacesDef): name = element.getName() base = element.getBase() ns_prefix = SchemaNamespaceDict.get(name) - if ns_prefix is not None: - namespace = ns_prefix + ':' + if ns_prefix is not None and ns_prefix[0] is not None: + namespace = ns_prefix[0] + ':' + ns_def = 'xmlns:{}'.format(ns_prefix[0]) + if ns_def not in nameSpacesDef: + nameSpacesDef += ' {}="{}"'.format(ns_def, ns_prefix[1]) wrt(" def export(self, outfile, level, namespace_='%s', " "name_='%s', namespacedef_='%s', pretty_print=True):\n" % (namespace, name, nameSpacesDef)) @@ -4349,7 +4352,7 @@ def processValidatorBodyRestrictions( pats1 = restriction.xpath( "./xs:pattern/@value", namespaces=ns) if pats1: - pats2 = ['^{}$'.format(replaceVbars(p1)) for p1 in pats1] + pats2 = [u'^{}$'.format(replaceVbars(p1)) for p1 in pats1] patterns1.append(pats2) # # Check for and generate code for each possible type of restriction. diff --git a/generateDS.txt b/generateDS.txt index 870ac5ef6c9b3303e2bd89f1e95c10f45fae3be1..86be3c3a4263d555a76f9a289dcb61b347fa137c 100644 --- a/generateDS.txt +++ b/generateDS.txt @@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema .. version -:revision: 2.29.6 +:revision: 2.29.7 .. version diff --git a/generateds_gui_notes.html b/generateds_gui_notes.html index e1920d128b9b6cf0259953cf15ca64c0420f47b1..f92b4b069054e698d04213c47c0b469dd423d221 100644 --- a/generateds_gui_notes.html +++ b/generateds_gui_notes.html @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.6</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.7</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">January 26, 2018</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">February 05, 2018</td> </tr> </tbody> </table> @@ -401,7 +401,7 @@ $ mv generateds_gui.mo locale/ru/LC_MESSAGES/ <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_gui_notes.txt">View document source</a>. -Generated on: 2018-01-27 00:06 UTC. +Generated on: 2018-02-05 22:01 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateds_gui_notes.txt b/generateds_gui_notes.txt index 51ed6e1d73694ee9f1c2f660e7f866624e568648..e509ff5909c6ab1ea0d10e6a3b3f5b813d1ae6b1 100644 --- a/generateds_gui_notes.txt +++ b/generateds_gui_notes.txt @@ -12,7 +12,7 @@ GenerateDS GUI Notes .. version -:revision: 2.29.6 +:revision: 2.29.7 .. version diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py index cabaf5b76c909166bdab2f1ac5db7e1996a7cc19..59f7cd71d11edc7bea0cfc4c93f142d94c36a5a2 100644 --- a/gui/generateds_gui.py +++ b/gui/generateds_gui.py @@ -41,7 +41,7 @@ from libgenerateDS.gui import generateds_gui_session # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.29.6' +VERSION = '2.29.7' ##VERSION## diff --git a/librarytemplate_howto.html b/librarytemplate_howto.html index b225b20b90440b2ae4550d9167499f5cf3501469..700cf0d5a8b31df89cbedb5127ec2943c35d718e 100644 --- a/librarytemplate_howto.html +++ b/librarytemplate_howto.html @@ -217,7 +217,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.6</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.7</td> </tr> </tbody> </table> @@ -226,7 +226,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">January 26, 2018</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">February 05, 2018</td> </tr> </tbody> </table> @@ -380,7 +380,7 @@ this command for your needs. For example, you may need to use <div class="footer"> <hr class="footer" /> <a class="reference external" href="librarytemplate_howto.txt">View document source</a>. -Generated on: 2018-01-27 00:06 UTC. +Generated on: 2018-02-05 22:01 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/librarytemplate_howto.txt b/librarytemplate_howto.txt index 70618b2b5cd5d2f79d29cdd9e831b17b494f1653..93e2b37b75fb82227de5da243ce37d7be82d53cc 100644 --- a/librarytemplate_howto.txt +++ b/librarytemplate_howto.txt @@ -8,7 +8,7 @@ How to package a generateDS.py generated library .. version -:revision: 2.29.6 +:revision: 2.29.7 .. version diff --git a/process_includes.py b/process_includes.py index 1da1edf08989f1bba86c5e3d170f9e3baa8f8840..57331e39c5558b22c787720120127ccd224312b6 100755 --- a/process_includes.py +++ b/process_includes.py @@ -40,7 +40,7 @@ except ImportError: # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.29.6' +VERSION = '2.29.7' ##VERSION## CatalogDict = {} @@ -280,7 +280,7 @@ def update_ns_dict(root, ns_dict, options): names = ([item.get('name') for item in items1] + [item.get('name') for item in items2]) for name in names: - ns_dict[name] = prefix + ns_dict[name] = (prefix, namespace) def get_root_file_paths(node, params, rootPaths, shallow): diff --git a/setup.py b/setup.py index 4ea8b3ddec0f0e57e92fea4f8213316f0086d3b9..4ed191cfb02d4305ae42fbcb8e760fcb1098a230 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup(name="generateDS", # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## - version="2.29.6", + version="2.29.7", ##VERSION## author="Dave Kuhlman", author_email="dkuhlman@davekuhlman.org", diff --git a/tests/test.py b/tests/test.py index 0007f1707abb1e3caae1cee7fce712f99e039a33..2c6c4e00fadd980d8bb859a838253925eb97433d 100755 --- a/tests/test.py +++ b/tests/test.py @@ -617,6 +617,7 @@ class GenTest(unittest.TestCase): '--member-specs=list -f ' '-o tests/%s2_sup.py -s tests/%s2_sub.py ' '--super=%s2_sup ' + '--external-encoding="utf-8" ' 'tests/%s.xsd' ) t_ = 'validate_simpletypes' diff --git a/tests/validate_simpletypes.xml b/tests/validate_simpletypes.xml index ba85927ba14ac42132e40ae461da391543c2bd66..4f95db3d25c2f924585c51ba264f0d4fde5ca799 100644 --- a/tests/validate_simpletypes.xml +++ b/tests/validate_simpletypes.xml @@ -30,6 +30,7 @@ <primative_integer>765</primative_integer> <primative_float>54.321</primative_float> <vbar_pattern_value>abcd</vbar_pattern_value> + <unicode_pattern_value>abçd</unicode_pattern_value> </sample1> <sample2_bad> <integer_range_1_value>2</integer_range_1_value> @@ -42,6 +43,7 @@ <totaldigits_value>12.456789</totaldigits_value> <anonymous_float_value>0.2</anonymous_float_value> <vbar_pattern_value>efgh</vbar_pattern_value> + <unicode_pattern_value>efğh</unicode_pattern_value> </sample2_bad> <sample3_bad> <integer_range_1_value>9</integer_range_1_value> diff --git a/tests/validate_simpletypes.xsd b/tests/validate_simpletypes.xsd index 17c00070934da8da5c3aaaf0f3320dc3bdd41e77..b6d1dc31b8b3a078e02d6001a1759a8b993abbde 100644 --- a/tests/validate_simpletypes.xsd +++ b/tests/validate_simpletypes.xsd @@ -37,6 +37,7 @@ <xs:element name="datetime_minexcl_value" type="datetime_minexcl_st"/> <xs:element name="datetime_maxexcl_value" type="datetime_maxexcl_st"/> <xs:element name="vbar_pattern_value" type="vbar_pattern_st"/> + <xs:element name="unicode_pattern_value" type="unicode_pattern_st"/> <!-- Test for use of anonymous simple type. --> <xs:element name="anonymous_float_value"> @@ -215,4 +216,10 @@ </xs:restriction> </xs:simpleType> + <xs:simpleType name="unicode_pattern_st"> + <xs:restriction base="xs:string"> + <xs:pattern value="abçd|ef\|gh" /> + </xs:restriction> + </xs:simpleType> + </xs:schema> diff --git a/tests/validate_simpletypes1_out.xml b/tests/validate_simpletypes1_out.xml index 8193ffe8fdf49f8476e7866ce8978c47120a642a..25c102ef6a3ae94a15609f4854e7b5127283fd8c 100644 --- a/tests/validate_simpletypes1_out.xml +++ b/tests/validate_simpletypes1_out.xml @@ -21,6 +21,7 @@ <datetime_minexcl_value>2015-07-01T14:20:10</datetime_minexcl_value> <datetime_maxexcl_value>2015-05-01T14:20:10</datetime_maxexcl_value> <vbar_pattern_value>abcd</vbar_pattern_value> + <unicode_pattern_value>abçd</unicode_pattern_value> <anonymous_float_value>2.2</anonymous_float_value> <primative_integer>765</primative_integer> <primative_float>54.320999999999998</primative_float> @@ -34,6 +35,7 @@ <min_max_length_value>mno pqr</min_max_length_value> <length_value>012345</length_value> <vbar_pattern_value>efgh</vbar_pattern_value> + <unicode_pattern_value>efğh</unicode_pattern_value> <anonymous_float_value>0.2</anonymous_float_value> </sample2_bad> <sample3_bad integer_range_1_value_with_default="6"> diff --git a/tests/validate_simpletypes1_sub.py b/tests/validate_simpletypes1_sub.py index 998fedf3e5bf000c2e299ee849a5057eef09b88a..2f67f90a4083ef62b484e68278d238d01068d65f 100644 --- a/tests/validate_simpletypes1_sub.py +++ b/tests/validate_simpletypes1_sub.py @@ -12,12 +12,13 @@ # ('-o', 'tests/validate_simpletypes2_sup.py') # ('-s', 'tests/validate_simpletypes2_sub.py') # ('--super', 'validate_simpletypes2_sup') +# ('--external-encoding', 'utf-8') # # Command line arguments: # tests/validate_simpletypes.xsd # # Command line: -# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" tests/validate_simpletypes.xsd +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" --external-encoding="utf-8" tests/validate_simpletypes.xsd # # Current working directory (os.getcwd()): # generateds @@ -40,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs): # Globals # -ExternalEncoding = 'ascii' +ExternalEncoding = 'utf-8' # # Data representation classes @@ -55,8 +56,8 @@ supermod.containerType.subclass = containerTypeSub class simpleOneTypeSub(supermod.simpleOneType): - def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): - super(simpleOneTypeSub, self).__init__(integer_range_1_value_with_default, integer_range_1_value, pattern_value, token_enum_value, integer_range_incl_value, integer_range_excl_value, min_max_length_value, length_value, totalDigits_value, date_minincl_value, date_maxincl_value, date_minexcl_value, date_maxexcl_value, time_minincl_value, time_maxincl_value, time_minexcl_value, time_maxexcl_value, datetime_minincl_value, datetime_maxincl_value, datetime_minexcl_value, datetime_maxexcl_value, vbar_pattern_value, anonymous_float_value, primative_integer, primative_float, ) + def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, unicode_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): + super(simpleOneTypeSub, self).__init__(integer_range_1_value_with_default, integer_range_1_value, pattern_value, token_enum_value, integer_range_incl_value, integer_range_excl_value, min_max_length_value, length_value, totalDigits_value, date_minincl_value, date_maxincl_value, date_minexcl_value, date_maxexcl_value, time_minincl_value, time_maxincl_value, time_minexcl_value, time_maxexcl_value, datetime_minincl_value, datetime_maxincl_value, datetime_minexcl_value, datetime_maxexcl_value, vbar_pattern_value, unicode_pattern_value, anonymous_float_value, primative_integer, primative_float, ) supermod.simpleOneType.subclass = simpleOneTypeSub # end class simpleOneTypeSub diff --git a/tests/validate_simpletypes1_sup.py b/tests/validate_simpletypes1_sup.py index dd6a1fa5e08bf1b4dcccd8ab7c8770748fcb259a..a850c1b2eb4d60314f4c6d74cfc9b89dd5826de1 100644 --- a/tests/validate_simpletypes1_sup.py +++ b/tests/validate_simpletypes1_sup.py @@ -13,12 +13,13 @@ # ('-o', 'tests/validate_simpletypes2_sup.py') # ('-s', 'tests/validate_simpletypes2_sub.py') # ('--super', 'validate_simpletypes2_sup') +# ('--external-encoding', 'utf-8') # # Command line arguments: # tests/validate_simpletypes.xsd # # Command line: -# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" tests/validate_simpletypes.xsd +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" --external-encoding="utf-8" tests/validate_simpletypes.xsd # # Current working directory (os.getcwd()): # generateds @@ -451,7 +452,7 @@ except ImportError as exp: # Globals # -ExternalEncoding = 'ascii' +ExternalEncoding = 'utf-8' Tag_pattern_ = re_.compile(r'({.*})?(.*)') String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') @@ -900,13 +901,14 @@ class simpleOneType(GeneratedsSuper): MemberSpec_('datetime_minexcl_value', ['datetime_minexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_minexcl_value'}, None), MemberSpec_('datetime_maxexcl_value', ['datetime_maxexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_maxexcl_value'}, None), MemberSpec_('vbar_pattern_value', ['vbar_pattern_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'vbar_pattern_value'}, None), + MemberSpec_('unicode_pattern_value', ['unicode_pattern_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'unicode_pattern_value'}, None), MemberSpec_('anonymous_float_value', ['anonymous_float_valueType', 'xs:float'], 0, 0, {u'type': u'xs:float', u'name': u'anonymous_float_value'}, None), MemberSpec_('primative_integer', 'xs:integer', 0, 0, {u'type': u'xs:integer', u'name': u'primative_integer'}, None), MemberSpec_('primative_float', 'xs:float', 0, 0, {u'type': u'xs:float', u'name': u'primative_float'}, None), ] subclass = None superclass = None - def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): + def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, unicode_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): self.original_tagname_ = None self.integer_range_1_value_with_default = _cast(int, integer_range_1_value_with_default) self.integer_range_1_value = integer_range_1_value @@ -987,6 +989,8 @@ class simpleOneType(GeneratedsSuper): self.datetime_maxexcl_value = initvalue_ self.vbar_pattern_value = vbar_pattern_value self.validate_vbar_pattern_st(self.vbar_pattern_value) + self.unicode_pattern_value = unicode_pattern_value + self.validate_unicode_pattern_st(self.unicode_pattern_value) self.anonymous_float_value = anonymous_float_value self.validate_anonymous_float_valueType(self.anonymous_float_value) self.primative_integer = primative_integer @@ -1044,6 +1048,8 @@ class simpleOneType(GeneratedsSuper): def set_datetime_maxexcl_value(self, datetime_maxexcl_value): self.datetime_maxexcl_value = datetime_maxexcl_value def get_vbar_pattern_value(self): return self.vbar_pattern_value def set_vbar_pattern_value(self, vbar_pattern_value): self.vbar_pattern_value = vbar_pattern_value + def get_unicode_pattern_value(self): return self.unicode_pattern_value + def set_unicode_pattern_value(self, unicode_pattern_value): self.unicode_pattern_value = unicode_pattern_value def get_anonymous_float_value(self): return self.anonymous_float_value def set_anonymous_float_value(self, anonymous_float_value): self.anonymous_float_value = anonymous_float_value def get_primative_integer(self): return self.primative_integer @@ -1067,7 +1073,7 @@ class simpleOneType(GeneratedsSuper): if not self.gds_validate_simple_patterns( self.validate_pattern_st_patterns_, value): warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) - validate_pattern_st_patterns_ = [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] + validate_pattern_st_patterns_ = [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']] def validate_token_enum_st(self, value): # Validate type token_enum_st, a restriction on xs:NMTOKEN. if value is not None and Validate_simpletypes_: @@ -1177,7 +1183,14 @@ class simpleOneType(GeneratedsSuper): if not self.gds_validate_simple_patterns( self.validate_vbar_pattern_st_patterns_, value): warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, )) - validate_vbar_pattern_st_patterns_ = [['^abcd$|^ef\\|gh$']] + validate_vbar_pattern_st_patterns_ = [[u'^abcd$|^ef\\|gh$']] + def validate_unicode_pattern_st(self, value): + # Validate type unicode_pattern_st, a restriction on xs:string. + if value is not None and Validate_simpletypes_: + if not self.gds_validate_simple_patterns( + self.validate_unicode_pattern_st_patterns_, value): + warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_unicode_pattern_st_patterns_, )) + validate_unicode_pattern_st_patterns_ = [[u'^ab\xe7d$|^ef\\|gh$']] def validate_anonymous_float_valueType(self, value): # Validate type anonymous_float_valueType, a restriction on xs:float. if value is not None and Validate_simpletypes_: @@ -1208,6 +1221,7 @@ class simpleOneType(GeneratedsSuper): self.datetime_minexcl_value is not None or self.datetime_maxexcl_value is not None or self.vbar_pattern_value is not None or + self.unicode_pattern_value is not None or self.anonymous_float_value is not None or self.primative_integer is not None or self.primative_float is not None @@ -1308,6 +1322,9 @@ class simpleOneType(GeneratedsSuper): if self.vbar_pattern_value is not None: showIndent(outfile, level, pretty_print) outfile.write('<vbar_pattern_value>%s</vbar_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), eol_)) + if self.unicode_pattern_value is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<unicode_pattern_value>%s</unicode_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.unicode_pattern_value), input_name='unicode_pattern_value')), eol_)) if self.anonymous_float_value is not None: showIndent(outfile, level, pretty_print) outfile.write('<anonymous_float_value>%s</anonymous_float_value>%s' % (self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), eol_)) @@ -1473,6 +1490,12 @@ class simpleOneType(GeneratedsSuper): self.vbar_pattern_value = vbar_pattern_value_ # validate type vbar_pattern_st self.validate_vbar_pattern_st(self.vbar_pattern_value) + elif nodeName_ == 'unicode_pattern_value': + unicode_pattern_value_ = child_.text + unicode_pattern_value_ = self.gds_validate_string(unicode_pattern_value_, node, 'unicode_pattern_value') + self.unicode_pattern_value = unicode_pattern_value_ + # validate type unicode_pattern_st + self.validate_unicode_pattern_st(self.unicode_pattern_value) elif nodeName_ == 'anonymous_float_value': sval_ = child_.text try: diff --git a/tests/validate_simpletypes1_warnings.txt b/tests/validate_simpletypes1_warnings.txt index 2b72df6b010bd6bdfb669ced141bd39b8aa2b965..3f77f4d42e2cd3b8fab82fc84c831a9cc973b38e 100644 --- a/tests/validate_simpletypes1_warnings.txt +++ b/tests/validate_simpletypes1_warnings.txt @@ -1,60 +1,62 @@ -tests/validate_simpletypes2_sup.py:1059: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:1065: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1069: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1082: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st +tests/validate_simpletypes2_sup.py:1088: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on token_enum_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1089: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1095: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1094: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st +tests/validate_simpletypes2_sup.py:1100: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_excl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1103: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1109: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1108: UserWarning: Value "012345" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1114: UserWarning: Value "012345" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1185: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1198: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1179: UserWarning: Value "efgh" does not match xsd pattern restrictions: [['^abcd$|^ef\\|gh$']] +tests/validate_simpletypes2_sup.py:1185: UserWarning: Value "efgh" does not match xsd pattern restrictions: [[u'^abcd$|^ef\\|gh$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1061: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:1192: UserWarning: Value "efğh" does not match xsd pattern restrictions: [[u'^ab\xe7d$|^ef\\|gh$']] + warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_unicode_pattern_st_patterns_, )) +tests/validate_simpletypes2_sup.py:1067: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1069: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1087: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1093: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1101: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1107: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1108: UserWarning: Value "01234567890" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1114: UserWarning: Value "01234567890" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1118: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st +tests/validate_simpletypes2_sup.py:1124: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on date_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1123: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st +tests/validate_simpletypes2_sup.py:1129: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on date_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1128: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st +tests/validate_simpletypes2_sup.py:1134: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on date_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1133: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st +tests/validate_simpletypes2_sup.py:1139: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on date_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1138: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st +tests/validate_simpletypes2_sup.py:1144: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on time_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1143: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st +tests/validate_simpletypes2_sup.py:1149: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on time_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1148: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st +tests/validate_simpletypes2_sup.py:1154: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on time_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1153: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st +tests/validate_simpletypes2_sup.py:1159: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on time_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1158: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st +tests/validate_simpletypes2_sup.py:1164: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on datetime_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1163: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st +tests/validate_simpletypes2_sup.py:1169: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on datetime_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1168: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st +tests/validate_simpletypes2_sup.py:1174: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on datetime_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1173: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st +tests/validate_simpletypes2_sup.py:1179: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on datetime_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1187: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1200: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1066: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st +tests/validate_simpletypes2_sup.py:1072: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on pattern_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1069: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1075: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1611: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType +tests/validate_simpletypes2_sup.py:1634: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} ) diff --git a/tests/validate_simpletypes2_sub.py b/tests/validate_simpletypes2_sub.py index 998fedf3e5bf000c2e299ee849a5057eef09b88a..2f67f90a4083ef62b484e68278d238d01068d65f 100644 --- a/tests/validate_simpletypes2_sub.py +++ b/tests/validate_simpletypes2_sub.py @@ -12,12 +12,13 @@ # ('-o', 'tests/validate_simpletypes2_sup.py') # ('-s', 'tests/validate_simpletypes2_sub.py') # ('--super', 'validate_simpletypes2_sup') +# ('--external-encoding', 'utf-8') # # Command line arguments: # tests/validate_simpletypes.xsd # # Command line: -# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" tests/validate_simpletypes.xsd +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" --external-encoding="utf-8" tests/validate_simpletypes.xsd # # Current working directory (os.getcwd()): # generateds @@ -40,7 +41,7 @@ def parsexml_(infile, parser=None, **kwargs): # Globals # -ExternalEncoding = 'ascii' +ExternalEncoding = 'utf-8' # # Data representation classes @@ -55,8 +56,8 @@ supermod.containerType.subclass = containerTypeSub class simpleOneTypeSub(supermod.simpleOneType): - def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): - super(simpleOneTypeSub, self).__init__(integer_range_1_value_with_default, integer_range_1_value, pattern_value, token_enum_value, integer_range_incl_value, integer_range_excl_value, min_max_length_value, length_value, totalDigits_value, date_minincl_value, date_maxincl_value, date_minexcl_value, date_maxexcl_value, time_minincl_value, time_maxincl_value, time_minexcl_value, time_maxexcl_value, datetime_minincl_value, datetime_maxincl_value, datetime_minexcl_value, datetime_maxexcl_value, vbar_pattern_value, anonymous_float_value, primative_integer, primative_float, ) + def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, unicode_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): + super(simpleOneTypeSub, self).__init__(integer_range_1_value_with_default, integer_range_1_value, pattern_value, token_enum_value, integer_range_incl_value, integer_range_excl_value, min_max_length_value, length_value, totalDigits_value, date_minincl_value, date_maxincl_value, date_minexcl_value, date_maxexcl_value, time_minincl_value, time_maxincl_value, time_minexcl_value, time_maxexcl_value, datetime_minincl_value, datetime_maxincl_value, datetime_minexcl_value, datetime_maxexcl_value, vbar_pattern_value, unicode_pattern_value, anonymous_float_value, primative_integer, primative_float, ) supermod.simpleOneType.subclass = simpleOneTypeSub # end class simpleOneTypeSub diff --git a/tests/validate_simpletypes2_sup.py b/tests/validate_simpletypes2_sup.py index dd6a1fa5e08bf1b4dcccd8ab7c8770748fcb259a..a850c1b2eb4d60314f4c6d74cfc9b89dd5826de1 100644 --- a/tests/validate_simpletypes2_sup.py +++ b/tests/validate_simpletypes2_sup.py @@ -13,12 +13,13 @@ # ('-o', 'tests/validate_simpletypes2_sup.py') # ('-s', 'tests/validate_simpletypes2_sub.py') # ('--super', 'validate_simpletypes2_sup') +# ('--external-encoding', 'utf-8') # # Command line arguments: # tests/validate_simpletypes.xsd # # Command line: -# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" tests/validate_simpletypes.xsd +# generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" --external-encoding="utf-8" tests/validate_simpletypes.xsd # # Current working directory (os.getcwd()): # generateds @@ -451,7 +452,7 @@ except ImportError as exp: # Globals # -ExternalEncoding = 'ascii' +ExternalEncoding = 'utf-8' Tag_pattern_ = re_.compile(r'({.*})?(.*)') String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') @@ -900,13 +901,14 @@ class simpleOneType(GeneratedsSuper): MemberSpec_('datetime_minexcl_value', ['datetime_minexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_minexcl_value'}, None), MemberSpec_('datetime_maxexcl_value', ['datetime_maxexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_maxexcl_value'}, None), MemberSpec_('vbar_pattern_value', ['vbar_pattern_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'vbar_pattern_value'}, None), + MemberSpec_('unicode_pattern_value', ['unicode_pattern_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'unicode_pattern_value'}, None), MemberSpec_('anonymous_float_value', ['anonymous_float_valueType', 'xs:float'], 0, 0, {u'type': u'xs:float', u'name': u'anonymous_float_value'}, None), MemberSpec_('primative_integer', 'xs:integer', 0, 0, {u'type': u'xs:integer', u'name': u'primative_integer'}, None), MemberSpec_('primative_float', 'xs:float', 0, 0, {u'type': u'xs:float', u'name': u'primative_float'}, None), ] subclass = None superclass = None - def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): + def __init__(self, integer_range_1_value_with_default='6', integer_range_1_value=5, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, unicode_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None): self.original_tagname_ = None self.integer_range_1_value_with_default = _cast(int, integer_range_1_value_with_default) self.integer_range_1_value = integer_range_1_value @@ -987,6 +989,8 @@ class simpleOneType(GeneratedsSuper): self.datetime_maxexcl_value = initvalue_ self.vbar_pattern_value = vbar_pattern_value self.validate_vbar_pattern_st(self.vbar_pattern_value) + self.unicode_pattern_value = unicode_pattern_value + self.validate_unicode_pattern_st(self.unicode_pattern_value) self.anonymous_float_value = anonymous_float_value self.validate_anonymous_float_valueType(self.anonymous_float_value) self.primative_integer = primative_integer @@ -1044,6 +1048,8 @@ class simpleOneType(GeneratedsSuper): def set_datetime_maxexcl_value(self, datetime_maxexcl_value): self.datetime_maxexcl_value = datetime_maxexcl_value def get_vbar_pattern_value(self): return self.vbar_pattern_value def set_vbar_pattern_value(self, vbar_pattern_value): self.vbar_pattern_value = vbar_pattern_value + def get_unicode_pattern_value(self): return self.unicode_pattern_value + def set_unicode_pattern_value(self, unicode_pattern_value): self.unicode_pattern_value = unicode_pattern_value def get_anonymous_float_value(self): return self.anonymous_float_value def set_anonymous_float_value(self, anonymous_float_value): self.anonymous_float_value = anonymous_float_value def get_primative_integer(self): return self.primative_integer @@ -1067,7 +1073,7 @@ class simpleOneType(GeneratedsSuper): if not self.gds_validate_simple_patterns( self.validate_pattern_st_patterns_, value): warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) - validate_pattern_st_patterns_ = [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] + validate_pattern_st_patterns_ = [[u'^aaa.*zzz$', u'^bbb.*xxx$'], [u'^.*123.*$', u'^.*456.*$']] def validate_token_enum_st(self, value): # Validate type token_enum_st, a restriction on xs:NMTOKEN. if value is not None and Validate_simpletypes_: @@ -1177,7 +1183,14 @@ class simpleOneType(GeneratedsSuper): if not self.gds_validate_simple_patterns( self.validate_vbar_pattern_st_patterns_, value): warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, )) - validate_vbar_pattern_st_patterns_ = [['^abcd$|^ef\\|gh$']] + validate_vbar_pattern_st_patterns_ = [[u'^abcd$|^ef\\|gh$']] + def validate_unicode_pattern_st(self, value): + # Validate type unicode_pattern_st, a restriction on xs:string. + if value is not None and Validate_simpletypes_: + if not self.gds_validate_simple_patterns( + self.validate_unicode_pattern_st_patterns_, value): + warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_unicode_pattern_st_patterns_, )) + validate_unicode_pattern_st_patterns_ = [[u'^ab\xe7d$|^ef\\|gh$']] def validate_anonymous_float_valueType(self, value): # Validate type anonymous_float_valueType, a restriction on xs:float. if value is not None and Validate_simpletypes_: @@ -1208,6 +1221,7 @@ class simpleOneType(GeneratedsSuper): self.datetime_minexcl_value is not None or self.datetime_maxexcl_value is not None or self.vbar_pattern_value is not None or + self.unicode_pattern_value is not None or self.anonymous_float_value is not None or self.primative_integer is not None or self.primative_float is not None @@ -1308,6 +1322,9 @@ class simpleOneType(GeneratedsSuper): if self.vbar_pattern_value is not None: showIndent(outfile, level, pretty_print) outfile.write('<vbar_pattern_value>%s</vbar_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), eol_)) + if self.unicode_pattern_value is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<unicode_pattern_value>%s</unicode_pattern_value>%s' % (self.gds_encode(self.gds_format_string(quote_xml(self.unicode_pattern_value), input_name='unicode_pattern_value')), eol_)) if self.anonymous_float_value is not None: showIndent(outfile, level, pretty_print) outfile.write('<anonymous_float_value>%s</anonymous_float_value>%s' % (self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), eol_)) @@ -1473,6 +1490,12 @@ class simpleOneType(GeneratedsSuper): self.vbar_pattern_value = vbar_pattern_value_ # validate type vbar_pattern_st self.validate_vbar_pattern_st(self.vbar_pattern_value) + elif nodeName_ == 'unicode_pattern_value': + unicode_pattern_value_ = child_.text + unicode_pattern_value_ = self.gds_validate_string(unicode_pattern_value_, node, 'unicode_pattern_value') + self.unicode_pattern_value = unicode_pattern_value_ + # validate type unicode_pattern_st + self.validate_unicode_pattern_st(self.unicode_pattern_value) elif nodeName_ == 'anonymous_float_value': sval_ = child_.text try: diff --git a/tutorial/generateds_tutorial.html b/tutorial/generateds_tutorial.html index e2c7c02cbd078430ed06ada71b0f5ef8455aacbb..6103b5a2c25adde1aacaa7c3e677d950a9b965bf 100644 --- a/tutorial/generateds_tutorial.html +++ b/tutorial/generateds_tutorial.html @@ -219,7 +219,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.6</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.29.7</td> </tr> </tbody> </table> @@ -228,7 +228,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">January 26, 2018</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">February 05, 2018</td> </tr> </tbody> </table> @@ -1210,7 +1210,7 @@ named <tt class="docutils literal">garden_api.py</tt>, you can create an instanc <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_tutorial.txt">View document source</a>. -Generated on: 2018-01-27 00:06 UTC. +Generated on: 2018-02-05 22:01 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/tutorial/generateds_tutorial.txt b/tutorial/generateds_tutorial.txt index d2a348432207d6f0848d6d31ca6219ea555410e1..0601deebc6574dc6132dfe6fd12c890d7e65385f 100644 --- a/tutorial/generateds_tutorial.txt +++ b/tutorial/generateds_tutorial.txt @@ -11,7 +11,7 @@ generateDS -- Introduction and Tutorial .. version -:revision: 2.29.6 +:revision: 2.29.7 .. version diff --git a/tutorial/generateds_tutorial.zip b/tutorial/generateds_tutorial.zip index 965b5f0d063bd7006612b72e3588a4f4755970ca..6af5372e5e0e6031da3fd616a99d1968c0f78bce 100644 Binary files a/tutorial/generateds_tutorial.zip and b/tutorial/generateds_tutorial.zip differ