Ticket #488 (closed defect: fixed)
RemotingService raises TypeError when deserializing an ArrayCollection
| Reported by: | mrflay | Owned by: | nick |
|---|---|---|---|
| Priority: | major | Milestone: | 0.4.2 |
| Component: | Utility | Version: | 0.4.1 |
| Keywords: | ArrayCollection RemotingService | Cc: | |
| Fixed in revision: | 2286 | Branch: | arraycollection-source-488 |
| Author: | mrflay, nick |
Description (last modified by thijs) (diff)
I have a pyamf 0.4.1 client that communicates with a BlazeDS 3.0.0.544 service running in a JBoss 4.2 application server.
The following error is raised on the client when an ArrayCollection is being deserialized.
Traceback (most recent call last): File "test.py", line 19, in <module> print service.list("3F3A66CA-B1BE-73D6-276D-D7CA9453BA90") File "build/bdist.linux-i686/egg/pyamf/remoting/client/__init__.py", line 52, in __call__ File "build/bdist.linux-i686/egg/pyamf/remoting/client/__init__.py", line 101, in _call File "build/bdist.linux-i686/egg/pyamf/remoting/client/__init__.py", line 409, in execute_single File "build/bdist.linux-i686/egg/pyamf/remoting/client/__init__.py", line 479, in _getResponse File "build/bdist.linux-i686/egg/pyamf/remoting/__init__.py", line 615, in decode File "build/bdist.linux-i686/egg/pyamf/remoting/__init__.py", line 454, in _read_body File "build/bdist.linux-i686/egg/pyamf/__init__.py", line 677, in readElement File "build/bdist.linux-i686/egg/pyamf/amf0.py", line 318, in readTypedObject File "build/bdist.linux-i686/egg/pyamf/amf0.py", line 365, in _readObject File "build/bdist.linux-i686/egg/pyamf/__init__.py", line 554, in applyAttributes File "build/bdist.linux-i686/egg/pyamf/util/__init__.py", line 767, in set_attrs TypeError: list indices must be integers
Cause:
The set_attrs method cannot initialize the ArrayCollection since it expects the associated attrs data to be an array, but it is actually an object {'source':[{'foo':'bar'},...]}.
Adding the following code
if isinstance(obj, pyamf.flex.ArrayCollection): obj.extend(attrs['source']) return
to the beginning of the set_attrs method allows the ArrayCollection to be deserialized on the client.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.



