Re: Issue 5 in pyactiveresource: pyactiveresource does not handle nested attributes correctly

4 views
Skip to first unread message

codesite...@google.com

unread,
Nov 17, 2009, 5:15:34 AM11/17/09
to pyactive...@googlegroups.com

Comment #2 on issue 5 by osvaldsson: pyactiveresource does not handle
nested attributes correctly
http://code.google.com/p/pyactiveresource/issues/detail?id=5

I'm running into this exact same problem, was there any proper fix yet or
should I just use the workaround
above?

/Oli

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Nov 17, 2009, 11:46:54 AM11/17/09
to pyactive...@googlegroups.com
Updates:
Status: WontFix

Comment #3 on issue 5 by nickesk: pyactiveresource does not handle nested
attributes correctly
http://code.google.com/p/pyactiveresource/issues/detail?id=5

The workaround above isn't exactly "correct" as it adds a "value" element
to the
array, which is not the behavior of Ruby ARes, which preserves the array
format.

>> class Slice < ActiveResource::Base
>> self.site = 'http://localhost:3000'
>> end

>> xml = '''...'''
>> site = Site.new(Hash.from_xml(xml)['site'])
>> site.addresses
=> ["173.45.XXX.XXX", "172.21.XXX.XXX"]

However as Mark mentions, to_xml blows up on the address Array

>> site.to_xml
RuntimeError: Not all elements respond to to_xml
...

So this is a problem with the server's XML not being ARes-compliant. PyARes
is a port
of the Ruby implementation, so this should be reported upstream if you feel
this is
really a bug.

codesite...@google.com

unread,
Nov 17, 2009, 11:50:59 AM11/17/09
to pyactive...@googlegroups.com

Comment #4 on issue 5 by nickesk: pyactiveresource does not handle nested
attributes correctly
http://code.google.com/p/pyactiveresource/issues/detail?id=5

Of course that should be "Slice.new(Hash.from_xml(xml)['slice'])" above

Reply all
Reply to author
Forward
0 new messages