-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/10/2013 10:48 AM, Bruk Habtu wrote: > Naming a view callable "settings" will raise an exception when it's > called. Is this intended? > > Traceback (most recent call last): >> File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/httpserver.py", >> line 1068, in process_request_in_thread >> self.finish_request(request, client_address) File >> "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request >> self.RequestHandlerClass(request, client_address, self) File >> "/usr/lib/python2.7/SocketServer.py", line 649, in __init__ >> self.handle() File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/httpserver.py", >> line 442, in handle BaseHTTPRequestHandler.handle(self) File >> "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle >> self.handle_one_request() File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/httpserver.py", >> line 437, in handle_one_request self.wsgi_execute() File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/httpserver.py", >> line 287, in wsgi_execute self.wsgi_start_response) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/router.py", >> line 251, in __call__ response = self.invoke_subrequest(request, >> use_tweens=True) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/router.py", >> line 227, in invoke_subrequest response = handle_request(request) >> File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/tweens.py", >> line 21, in excview_tween response = handler(request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", >> line 82, in tm_tween reraise(*exc_info) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", >> line 63, in tm_tween response = handler(request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/router.py", >> line 161, in handle_request response = view_callable(context, >> request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/config/views.py", >> line 586, in __call__ return view(context, request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/config/views.py", >> line 319, in attr_view return view(context, request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/config/views.py", >> line 295, in predicate_wrapper return view(context, request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/config/views.py", >> line 345, in rendered_view result = view(context, request) File >> "/home/bruk/.virtualenvs/base/local/lib/python2.7/site-packages/pyramid-1.4-py2.7.egg/pyramid/config/views.py", >> line 481, in _class_view response = getattr(inst, attr)() >> TypeError: 'Settings' object is not callable > > > My code > > @view_defaults(route_name='main') >> class SearchHandler(base.Handler): >> @action_config(renderer='search.mako') >> @action_config(route_name='main ext', renderer='search.mako') def >> settings(self): """ Search schedules for events. """ > > > Where action_config is a decorator that extands view_config to use the > wrapped function's name as a predicate match for the action param in > rhe matchdict. If the view callable is named "search", it executes > without problem.
I don't think this is a Pyramid problem. The following code works fine, adapted from the 'starter' template:: from pyramid.view import view_config class MyViews(object): def __init__(self, context, request): self.context = context self.request = request @view_config(route_name='home', renderer='templates/mytemplate.pt') def settings(self): return {'project': 'classview'} - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlKnUvsACgkQ+gerLs4ltQ5muwCgg3/s9ovYsYOZGLBzchsSM8fJ Nr8AnA8UzUcGqKTFal9KL//5LN9hosih =tx4Z -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/groups/opt_out.