On 10/17/11 15:07, B.Nanda Kishore wrote: > > Hello Everybody, > > I have been using soaplib since a few weeks. One thing caught my eye. > Its the "Date" and "DateTime" data types. I wanted to have a > customized representation/format of the Date object when the xml tree > is generated. The default one is YYYY-MM-DD. But what if I wanted to > have YYYY/MM/DD or DD-MM-YYYY ? I have tried to look for a way I can > do it with the existing soaplib API. Unfortunately I was not able to > figure out. Can you please guide me ? If I know the trick, I can > implement it and will send a pull-request for your review. Please help. >
Hello Nanda, The current date format in both soaplib and rpclib respects the SOAP standard which in turn respects relavant iso standard on encoding date/time information. So i do not suggest you to alter the way the Date and DateTime objects are serialized. That said, you can have a look at: https://github.com/arskom/rpclib/blob/master/src/rpclib/model/primitive.py#L343 to see how the date object works in rpclib. copy that class, change its name, alter its from_string and to_string methods to your liking and voila, you have your own date class. it's almost the same for soaplib, just a bit more inconsistent. have a look at: https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/model/primitive.py#L196 you should alter to_parent_element and from_string methods in a custom model class that inherits from SimpleType. hope that helps best burak _______________________________________________ Soap mailing list [email protected] http://mail.python.org/mailman/listinfo/soap
