Menu

#71 Content type mismanagement with renamed element

PyXB 1.2.1
closed
None
fixed
Binding model
minor
PyXB 1.1.0
defect
2012-12-16
2010-01-21
No

Refer to the example posted in the Help forum: https://sourceforge.net/projects/pyxb/forums/forum/956708/topic/3526055

If the field element created by the second-level pyxb.BIND wrapper uses key=value syntax instead of positional parameters, there is a conflict because the second element is named "value". PyXB will have renamed that to "value_". Attempts to use "value=pyxb.BIND(...)" seem to cause the corresponding element to be dropped; attempts to use "value_=pyxb.BIND(...)" generate a content error.

Discussion

  • Peter A. Bigot

    Peter A. Bigot - 2010-01-28
    • status changed from new to accepted

    The use of "value" elicits the problem described in #76. Ignore that for now. The use of "value_" should work.

     
  • Peter A. Bigot

    Peter A. Bigot - 2010-01-28
    • milestone changed from PyXB 1.1.1 to PyXB 1.1.2

    This has close associations with #75.

     
  • Peter A. Bigot

    Peter A. Bigot - 2010-05-30
    • milestone changed from PyXB 1.1.2 to PyXB 1.1.3
     
  • Peter A. Bigot

    Peter A. Bigot - 2011-09-09
    • milestone changed from PyXB 1.1.3 to PyXB 1.1.4
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-06-13
    • milestone changed from PyXB 1.1.4 to PyXB 1.1.5
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-06-15
    • description modified (diff)

    add link to referenced help forum example posting.

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-06-15

    The first case does fail because "value" is not a valid element after the renaming. PyXB should have validated that when the append was invoked, not simply stored the value in the content list.

    The second fails because the element is plural, but is being invoked as a "set" with a non-plural value. This is valid for the non-keyword version because the state machine can expect additional elements; with keyword, the state requires all elements to be provided at once.

    Again this should have been validated at the time of the append.

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-08-30
    • milestone changed from PyXB 1.1.5 to PyXB 1.2.0
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-11-08
    • milestone changed from PyXB 1.2.0 to PyXB 1.2.1
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-12-16
    • status changed from accepted to closed
    • resolution set to fixed

    The other part of this is fixed in the context of #69.

    commit 993c26292c883528f35bc3a6a1f657ddd7a47dc0
    Author: Peter A. Bigot <pab@‌>
    Date: Sun Dec 16 08:52:25 2012 -0600

    trac/71: content type mismanagement with renamed element

    Two fixes:

    • When a pyxb.BIND instance is not recognized, raise a content error rather than attempting to provide it as mixed content

    • When a pyxb.BIND instance is being set as an element value, convert it to a compatible value even if validation is not occurring.

    The other problem with this example is that the pyxb.BIND instances intended
    to become timestamps were being added to a plural element for which the
    value is a simple list that does no type-checking. Thus the errors could
    not be detected until validation was actually performed.

     
MongoDB Logo MongoDB