#200 Unable to create nillable instances of classes that require constructor arguments

PyXB 1.2.3
closed
None
fixed
Binding model
major
PyXB 1.2.2
defect
2013-07-08
2013-05-31
No

See https://sourceforge.net/p/pyxb/discussion/956708/thread/4647234c/

xs:dateTime inherits from datetime.datetime so attempts to create nil instances are rejected by the superclass constructor. This suggests we need a dummy class to produce instances of nil element values where there is no such thing as a nil instance of the type to which the value must conform.

1 Attachments

Discussion

  • Peter A. Bigot

    Peter A. Bigot - 2013-05-31
    • status changed from new to accepted

    After further consideration this can be handled similarly to other simple types that descend from Python classes by marking the instance as nil but allowing it to have a default value consistent with the Python type.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-05-31
    • status changed from accepted to closed
    • resolution set to fixed

      commit 7e098ec00f0f51e24c03bc11effd11c0d5d88013
      Author: Peter A. Bigot pab@pabigot.com
      Date: Fri May 31 14:32:30 2013 -0500

      trac/200: Unable to create nillable instance of some simple types
      
      If the instance is to be nil but the underlying Python type requires a
      constructor parameter, provide arguments that satisfy the underlying Python
      class.
      
      Validated for all PyXB simple types that overload the __new__ function to
      infer constructor arguments from lexical representations.
      

      :100644 100644 d7b2404... 3c7e6a3... M pyxb/binding/datatypes.py
      :000000 100644 0000000... 6d5c256... A tests/trac/test-trac-0200.py

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-07-08
    • milestone set to PyXB 1.2.3
     

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

Sign up for the SourceForge newsletter:





No, thanks