Configurator.add_directive should accept arbitrary callables #621

Closed
squeaky-pl opened this Issue Jun 12, 2012 · 3 comments

Projects

None yet

3 participants

@squeaky-pl

Configurator.add_directive should accept arbitrary callables like partials or objects implementing __call__ which dont have __name__ and __doc__ attributes. Currently it is not possible because of sphnix/docutils compatibility code executed upon __getattr__ in pyramid/config/util.py in function action_method where __name__ and __doc__ are copied (line no. 62 and 63) without checking if there are in place first. Suggested resolution would be to check with hasattr if they exist on wrapped callable before attempting copying.

@mcdonc
Member
mcdonc commented Jun 13, 2012

Agreed. pyramid.wsgi.wsgiapp and pyramid.wsgi.wsgiapp2 account for this (they happen to use functools.wraps to get it done). The above-referenced code should do something similar.

@wwitzel3 wwitzel3 added a commit to wwitzel3/pyramid that referenced this issue Aug 3, 2012
@wwitzel3 wwitzel3 Tests for fixing issue #621 0d8ff5b
@wwitzel3 wwitzel3 added a commit to wwitzel3/pyramid that referenced this issue Aug 3, 2012
@wwitzel3 wwitzel3 Fix for issue #621 0f0629f
@wwitzel3
Contributor
wwitzel3 commented Aug 6, 2012

All updates push, let me know if you need me to make any other changes.

@mcdonc
Member
mcdonc commented Aug 24, 2012

A fix was committed via 20f2de5...bf64f1e

@mcdonc mcdonc closed this Aug 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment