Skip to content

Commit 256c91e

Browse files
author
Greg Turnquist
committed
SESPRINGPYTHONPY-134: Fixed bug where AopProxy was hard coded to only handle classic classes.
1 parent 0a4d67a commit 256c91e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/springpython/aop/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ class AopProxy(object):
167167
lookups are not intercepted, but instead fetched from the actual target object."""
168168

169169
def __init__(self, target, interceptors):
170-
if type(target).__name__ != "instance":
171-
raise Exception("Target attribute must be an instance.")
172170
self.target = target
173171
if type(interceptors) == list:
174172
self.interceptors = interceptors

test/springpythontest/aopTestCases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def testCreatingAopProxyFactoryAndAddingInterceptorToNewStyleClassProgammaticall
6161
factory.target = NewStyleSampleService()
6262
factory.interceptors.append(WrappingInterceptor())
6363
service = factory.getProxy()
64-
self.assertEquals("<Wrapped>Alright!</Wrapped>", service.doSomething())
65-
self.assertEquals("<Wrapped>You made it! => test</Wrapped>", service.method("test"))
66-
self.assertEquals("sample", service.attribute)
64+
self.assertEquals("<Wrapped>Even better!</Wrapped>", service.doSomething())
65+
self.assertEquals("<Wrapped>You made it to a new style class! => test</Wrapped>", service.method("test"))
66+
self.assertEquals("new_sample", service.attribute)
6767

6868
def testCreatingAProxyFactoryAndAddingAnInterceptorIoC(self):
6969
factory = self.appContext.get_object("factory")

0 commit comments

Comments
 (0)