You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyramid.exceptions.ConfigurationExecutionError: <type 'exceptions.AttributeError'>: 'instancemethod' object has no attribute '__text__'
in:
Line 14 of file helloworld.bugdemo.py:
config.add_view(f.hello_world, route_name='hello')
workaround:
a workaround until this is fixed can be done by changing to:
config.add_view(self, attr="somemethod", route_name="something")
sample code:
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
class foo:
def hello_world(self, root, request):
return Response('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
config = Configurator()
f= foo()
config.add_route('hello', '/hello/{name}')
config.add_view(f.hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
complete traceback:
Traceback (most recent call last):
File "helloworld.bugdemo.py", line 15, in <module>
app = config.make_wsgi_app()
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/__init__.py", line 921, in make_wsgi_app
self.commit()
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/__init__.py", line 594, in commit
self.action_state.execute_actions(introspector=self.introspector)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/__init__.py", line 1049, in execute_actions
tb)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/__init__.py", line 1041, in execute_actions
callable(*args, **kw)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 1087, in register
derived_view = deriver(view)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 142, in __call__
self.mapped_view(view)))))))))
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 87, in inner
wrapper_view = wrapper(self, view)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 154, in mapped_view
mapped_view = mapper(**self.kw)(view)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 395, in __call__
view = self.map_nonclass(view)
File "/home/dev/www/env/lib/python2.6/site-packages/pyramid/config/views.py", line 426, in map_nonclass
mapped_view.__text__ = object_description(view)
pyramid.exceptions.ConfigurationExecutionError: <type 'exceptions.AttributeError'>: 'instancemethod' object has no attribute '__text__'
in:
Line 14 of file helloworld.bugdemo.py:
config.add_view(f.hello_world, route_name='hello')
The text was updated successfully, but these errors were encountered:
hlv42
pushed a commit
to hlv42/pyramid
that referenced
this issue
Mar 5, 2012
- config.add_view() raises an AttributeError for __text__ if the View is an instancemethod.
added wrapper adding the __text__ attribute if it isnt present yet.
hlv42
added a commit
to hlv42/pyramid
that referenced
this issue
Mar 6, 2012
it possible for instance methods to be used as view callables) introduced a
backwards incompatibility when methods that declared only a request
argument were used. See Pylons#503FixesPylons#503
bug
using
raises
workaround:
a workaround until this is fixed can be done by changing to:
config.add_view(self, attr="somemethod", route_name="something")
sample code:
complete traceback:
The text was updated successfully, but these errors were encountered: