assertion failure generating extension bindings #18

Closed
pabigot opened this Issue Aug 19, 2014 · 1 comment

Projects

None yet

1 participant

@pabigot
Owner
pabigot commented Aug 19, 2014

The bindings for http://www.w3.org/2005/Atom are generated as a side effect of the bindings for http://www.opengis.net/kml/2.2. The assertion below fails when building extension bindings for the latter namespace, as described in this SO question:

File "/opt/pyxb/pyxb/binding/generate.py", line 1520, in importForDeclaration
assert sdecl._objectOrigin().moduleRecord().namespace() == ns

Chances are this assertion is simply being too strict, or the correct namespace should be located elsewhere.

@pabigot
Owner
pabigot commented Aug 19, 2014

As a workaround, commenting out the assertion appears to result in correct bindings being generated.

@pabigot pabigot added this to the PyXB 1.2.4 milestone Aug 26, 2014
@pabigot pabigot self-assigned this Aug 26, 2014
@pabigot pabigot added the bug label Aug 26, 2014
@pabigot pabigot added a commit that closed this issue Oct 19, 2014
@pabigot fix #18: assertion failure generating extension bindings
The assertion attempted to verify that the namespace for the module from
which a declaration came was the same as the namespace for the
declaration.  In the case here that is not the case: the origin module
is pyxb.bundles.opengis.ogckml22 and the referenced declaration
namespace is http://www.w3.org/2005/Atom, which is itself imported
into ogckml22 from pyxb.bundles.opengis.atom.

However, the origin module does import the bindings for the referenced
declaration, so the subsequent code that imports it satisfies the
requirement and the assertion may be removed.

To determine the true module of origin would require recording origins
across independent binding generation sessions; this is unnecessary.

Reproducing command:

    pyxbgen \
      --archive-path='&pyxb/bundles/opengis//' \
      --schema-location=http://code.google.com/apis/kml/schema/kml22gx.xsd \
      --module=kml22gx
7c6bdf4
@pabigot pabigot closed this in 7c6bdf4 Oct 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment