Re: [pyxser-users] Pyxser generates strange 'name' attribute values
Brought to you by:
damowe
From: Daniel M. W. <dm...@co...> - 2010-05-04 13:13:56
|
On Tuesday 04 May 2010, Max Sinelnikov <ms...@gm...> wrote: > Hi! Hello Max, > Thank you for your work on this module! I'm writing web-application > using Pylons and XSLT as a template system. That's why I really need > for something that can serialize python objects to XML. OK, no problem with that. > Pyxser seems to be good for solving my problem, but when I've tried to > serialize SQLAlchemy-based object I got invalid XML with strange > values of atrributes named "name": The 'name' attribute stands for the name of the object attributes. Seems that your application have some 'unicode' names in your attribute names, so pyxser is using them as normal python strings, and not unicode names, let me check if those names are unicode for the next release. For example if your application have an object name obj with an attribute names "hòlá", pyxser will not serialise the name properly since it handles attribute names as normal strings, that's because you have all that garbage. This week I will release a new version of pyxser (1.4.4r), so you will get this week a new revision of it ;) > > <pyxs:obj xmlns:pyxs="http://projects.coder.cl/pyxser/model/" > version="1.0" type="Company" module="unigineportal.model.company" > objid="id-33378896"> >  <pyxs:col type="InstrumentedList" name="users"> >   <pyxs:obj type="User" name="users" > module="unigineportal.model.user" objid="id-33410320"> >    <pyxs:prop type="str" > name=";^A@Hpìû^A">sha1$4qQ1s$00f0c6fe031b3cd7900e158fb1ef8133dd4f5fdc</ > pyxs:prop>    <pyxs:col type="InstrumentedList" name="roles"/> >    <pyxs:prop type="str" name="^Pat²Ãéû^A">User1</pyxs:prop> >    <pyxs:prop type="str" name="^[2=ñp^Kþ^A">UU</pyxs:prop> >    <pyxs:obj module="unigineportal.model.company" type="Company" > name="company" objref="id-33378896"/> >    <pyxs:prop type="long" name="vV^ð0çû^A">1</pyxs:prop> >    <pyxs:prop type="long" name="ÃQ<9f>Ãð^Lþ^A">1</pyxs:prop> >    <pyxs:prop type="str" name="÷Ãà @^Kþ^A">user1</pyxs:prop> >    <pyxs:prop type="str" > name="password">sha1$4qQ1s$00f0c6fe031b3cd7900e158fb1ef8133dd4f5fdc</pyxs > :prop>    <pyxs:prop type="str" > name="'©Fü^P^Nþ^A">u1...@c1...</pyxs:prop>    <pyxs:col type="list" > name="permissions"/> >   </pyxs:obj> >   <pyxs:obj type="User" name="permissions" > module="unigineportal.model.user" objref="id-33410192"/> >  </pyxs:col> > > > Sometimes attribute's value is valid(<pyxs:col type="InstrumentedList" > name="roles"/>), sometimes not(<pyxs:prop type="str" > name=";^A@Hpìû^A">. I use 1.4.2r version. Do you have any ideas why it > happens and what to do with? I see... let me try some examples like that here, and fix it. You will get a new release this week ;) Thank you very much for your feedback... > > [SNIP] > Best regards, -- Daniel Molina Wegener <dmw [at] coder [dot] cl> Software Architect, System Programmer & Web Developer Phone: +56 (2) 979-0277 | Blog: http://coder.cl/ |