[Soap-Python] Multiple decorators

Burak Arslan burak.arslan at arskom.com.tr
Fri Sep 30 14:07:43 CEST 2011


On 30.09.2011 14:50, azurIt wrote:
> Maybe i misunderstood the usage (documentation is really horrible) but:
> 1.) yes, it is working without errors
> 2.) it's unusable
>
> i created this test script:
>
> ===============
>
> from decorator import decorator
>
> def _do_something(func, *args, **kw):
> 	print "before call"
> 	result = func(*args, **kw)
> 	print "after call"
> 	return result
>
> def my_decor(f):
> 	return decorator(_do_something, f)
>
>
> class tests(ServiceBase):
>
> 	@my_decor
> 	@srpc(ComplexTypes.Integer, _returns=ComplexTypes.Integer)
> 	def testf(first):
> 		return first
>
> ===============
>
> decorator was processed only once (on startup) and every call of testf() doesn't trigger it again.
>
>

that's normal, you should try that the other way round (i.e. @srpc above 
@my_decor) if you want that to run every time the method is called.

burak




More information about the Soap mailing list