----- Original message ----- > On Thu, 21 Jul 2011 10:23:33 +0300 > Burak Arslan <[email protected]> wrote: > > > ----- Original message ----- > > > To self reference a a complex type, you hace to use something like : > > > > > > class Foo(ComplexModel): > > > bar = None > > > > > > Foo.bar = Foo > > It's not working (wrong wsdl and meaningless attribute when used) > > > class Foo(ComplexModel): > > class Attributes(ComplexModel.Attributes) > > attr = String > > > > Foo._type_info['bar'] = Foo > > > > if i'm not mistaken. check with the source code. > > Ok that's working, but it's not very straightforward (and undocumented) > so yesterday i was messing around with the src code and forked soaplib > on github. I came with this (so far, it's working) : > https://github.com/tzelen/soaplib/commit/eb9f910458d6d1df3f4b54c2c84a82cb63e4171a > > Example : > class Object(ClassModel): > value = AutoRef > # value will be Object in the wsdl generation and in the xml objects. > > With _type_info explained here I looked to patch > ClassModelMeta.__new__() to add an exception in the "populate soap > member" section to accept something like 'self' (django model style) > to do the self referencing. I think it would be simple and easy, but > since the type is only created at the end of __new__(), it need a > 2-pass algorithm and would probably be ugly. > > Any thought on adding a mechanism for the self referencing vs editing > _type_info by hand? >
to do that, you need to hack __init__ and not __new__ in the metaclass. best, burak > Best regards, > T. > _______________________________________________ > Soap mailing list > [email protected] > http://mail.python.org/mailman/listinfo/soap
_______________________________________________ Soap mailing list [email protected] http://mail.python.org/mailman/listinfo/soap
