Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyXB and python frameworks

I used PyXB to generate Python modules out of a java/spring platform that exposes its classes schemas in XSD format via a RESTfull API.

I am now able to parse the XML data that the same platform serves, using those PyXB binding classes/modules.

My question is:

  • How can I leverage those classes, in frameworks like Django or pyramid, to build dynamic model forms, tables, etc, as I would do using models coming from models.py django ORM, or via colander/deform or pyramid-simpleform?
  • Has anybody used PyXB classes in any of those frameworks yet?
like image 806
DevLounge Avatar asked Oct 12 '12 20:10

DevLounge


1 Answers

One way to do it would be to create a mapping from PyXB bindings to form library. For example, it shouldn't be too hard to write some code that generate a colander schema from a PyXB class. Once you have the schema, all you need is a way to serialize and deserialize your objects in the same format (which quite simple : only values in lists and dicts), and you'll be able to create forms from PyXB objects and save them back.

This has already been done with colander and sqlalchemy, and the code for ColanderAlchemy may give you some inspiration on how to do it.

Bonus points if you put it on pypi :)

like image 79
madjar Avatar answered Sep 18 '22 10:09

madjar