Issue Details (XML | Word | Printable)

Key: SESPRINGPYTHONPY-86
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Greg Turnquist
Reporter: Greg Turnquist
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
SX Spring Python

XMLConfig doesn't properly lookup constructor-arg's, but instead returns ReferenceDef objects

Created: 09/Dec/08 06:34 AM   Updated: 09/Dec/08 12:17 PM
Component/s: IoC
Affects Version/s: 0.9
Fix Version/s: 0.9.1

Time Tracking:
Not Specified

File Attachments: 1. File patch.diff (9 kB)



 Description  « Hide
The following code demonstrates the issue:
==========================================
appContext.xml
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.org/springpython/schema/objects"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/springpython/schema/objects
                http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd">

    <object id="controller" class="sample.Controller">
        <property name="executors">
            <list>
                <ref object="exec1"/>
                <ref object="exec2"/>
            </list>
        </property>
    </object>

    <object id="exec1" class="sample.Executor"/>

    <object id="exec2" class="sample.Executor"/>

</objects>
==========================================
sample.py
------------------------
from springpython.config import XMLConfig
from springpython.context import ApplicationContext

class Controller(object):
    def __init__(self, executors=None):
        self.executors = executors

class Executor(object):
    pass

if __name__ == "__main__":
    appContext = ApplicationContext(XMLConfig("appContext.xml"))

    obj = appContext.get_object("controller")

    print obj
    print dir(obj)
    print obj.executors


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Greg Turnquist added a comment - 09/Dec/08 11:58 AM
The patch file is already committed to the branch. This is for people that need a quick patch, and not waiting for trunk merges or a release.

Greg Turnquist added a comment - 09/Dec/08 12:17 PM
Wrote test procedure exposing problem with lists. Extended test cases to other collections. Fixed IoC and verified all test cases passed.