#186 regex issue

PyXB 1.1.6
closed
None
fixed
Code
major
PyXB 1.1.5
defect
2013-02-01
2013-02-01
No

Traceback (most recent call last):

File "./siptrunk.py", line 559, in <module>

SansayXMLBuilder().main()

File "./siptrunk.py", line 553, in main

self.build_resource()

File "./siptrunk.py", line 398, in build_resource

resource = self.build_ip_resource(trunk_record)

File "./siptrunk.py", line 352, in build_ip_resource

rtid=trunk_recordroute_table_id_number

File "./siptrunk.py", line 268, in resource_factory

'ingress1' : self.schema.resources.XBIngress(match='all', action1='none', digits1=, action2='none', digits2=),

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 1705, in init

fu.set(self, iv)

File "/Library/Python/2.7/site-packages/pyxb/binding/content.py", line 561, in set

value = self.elementBinding.compatibleValue(value, is_plural=self.isPlural())

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 1406, in compatibleValue

return self.typeDefinition()._CompatibleValue(value, **kw)

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 285, in _CompatibleValue

return cls(value)

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 786, in init

self.xsdConstraintsOK()

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 918, in xsdConstraintsOK

return self.XsdConstraintsOK(self)

File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 912, in XsdConstraintsOK

if not f.validateConstraint(value):

File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 186, in validateConstraint

return self._validateConstraint_vx(value)

File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 436, in _validateConstraint_vx

if pe.matches(value):

File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 393, in matches

self.compiledExpression = re.compile(self.pythonExpression)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 190, in compile

return _compile(pattern, flags)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 245, in _compile

raise error, v # invalid expression

sre_constants.error: bad character range

1 Attachments

Discussion

  • Karl Putland

    Karl Putland - 2013-02-01

    schema

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-02-01
    • status changed from new to accepted

    I can't duplicate the problem with either 1.1.6-DEV (== 1.1.5) or 1.2.2-DEV (mostly ==1.2.1), using Python 2.7.3 in my native Linux environment. Please add host OS, Python version, pyxbgen command line, and other relevant information, and if possible a reduced schema.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-02-01

    As I look more closely this seems to be a runtime error rather than a problem generating the module. Please provide enough information to reproduce the problem (a document that cannot be processed, or a Python sequence that generates the exception).

     
  • Karl Putland

    Karl Putland - 2013-02-01

    Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import plat
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: No module named plat
    >>> import platform
    >>> platform.platform
    <function platform="" at="" 0x10b80af50="">
    >>> platform.platform()

    'Darwin-11.4.2-x86_64-i386-64bit'
    >>>
    
     
  • Karl Putland

    Karl Putland - 2013-02-01

    pyxbgen -u 8_3_2_resource.xsd -m resources

    # python
    
    >>> import resources
    >>> ingress = resources.XBIngress(match='all', action1='none', digits1="", action2='none', digits2="")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 1705, in __init__
        fu.set(self, iv)
      File "/Library/Python/2.7/site-packages/pyxb/binding/content.py", line 561, in set
        value = self.__elementBinding.compatibleValue(value, is_plural=self.isPlural())
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 1406, in compatibleValue
        return self.typeDefinition()._CompatibleValue(value, **kw)
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 285, in _CompatibleValue
        return cls(value)
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 786, in __init__
        self.xsdConstraintsOK()
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 918, in xsdConstraintsOK
        return self.XsdConstraintsOK(self)
      File "/Library/Python/2.7/site-packages/pyxb/binding/basis.py", line 912, in XsdConstraintsOK
        if not f.validateConstraint(value):
      File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 186, in validateConstraint
        return self._validateConstraint_vx(value)
      File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 436, in _validateConstraint_vx
        if pe.matches(value):
      File "/Library/Python/2.7/site-packages/pyxb/binding/facets.py", line 393, in matches
        self.__compiledExpression = re.compile(self.__pythonExpression)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 190, in compile
        return _compile(pattern, flags)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 245, in _compile
        raise error, v # invalid expression
    sre_constants.error: bad character range
    >>>
    
     
  • Peter A. Bigot

    Peter A. Bigot - 2013-02-01
    • status changed from accepted to closed
    • resolution set to fixed
    • component changed from Generation Model to Code
    • milestone changed from PyXB 1.1.6 to PyXB 1.2.2

    commit ad44667b071629045aa0a2272a6b1b5a9e41c4af
    Author: Peter A. Bigot <pab@…>
    Date: Fri Feb 1 05:46:25 2013 -0600

    trac/186: regex issue

    This error was due to a range A-B where B < A due to mis-management of the
    maximum valid codepoint. It was fixed as a side effect of fixing trac/187.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-02-01

    I back-ported the fix for #187 to the pyxb-1.1/next branch. You only need the patch from this commit:

    commit e104dc436780ff16a2f2e72ac6a124932df10a99
    Author: Peter A. Bigot <pab@…>
    Date: Fri Feb 1 05:39:15 2013 -0600

    trac/187: Wide unicode mis-defines XML1p0e2 Char class

    Correct the call so the range is recognized. Also correct error that
    improperly excluded MaxCodePoint as a valid character. The test for this
    error is in test-unicode.py.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-02-01
    • milestone changed from PyXB 1.2.2 to PyXB 1.1.6
     
  • Karl Putland

    Karl Putland - 2013-02-01

    Resolved my issue.

    Thanks,

    --Karl

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks