(Originally from Mike Orr) I've got a first draft of the Pylons 2 Users Guide done. The "hello world" page is the only page that's completed; it goes through installing a default application and looking through the application code. I haven't gone through the Pylons code or BFG code or BFG manual yet; I just went with "it must be so in order for the application code to work", based on an earlier email exchange with Ben about the application structure. The emails are also included for reference on a separate page.
HTML version: http://sluggo.scrapping.cc/tmp/execution/ Repository: http://bitbucket.org/sluggo/execution I found a few bugs and unknown things as I went along. 1) I couldn't create an application with a capital letter, as shown in the traceback below. 2) The interactive traceback doesn't work; I just got an "Internal Server Error" when I raised RuntimeError. This makes it impossible to inspect a live request. 3) "paster shell" doesn't work, so I couldn't inspect a request that way. 4) Where is "routehelper" imported from? 5) What is Request.abort_session() for? is that to rollback changes to the session? Or is it to forget the session when you log out? 6) Where is the code behind @action? The definition simply puts **kw on the .__exposed__ attribute of the view method. But I couldn't find anything in Pylons or BFG that would plug the return dict into a Mako template and create a Response, yet it must be doing it somehow. 7) How do you change template engines? Specifically Genshi and Jinja2, which are popular among Pylons users. 8) Is it worth documenting Request.add_response_callback(), config.add_subscriber, .add_view, .add_route, and the config.__init__ args for Pylons? It seems like .add_handler is enough. I skipped over a bunch of other Config methods that looked irrelevant. * * * With the "pylons_newminimal" template, I could make an application called "hello" but not "Hello" (capitalized). When I created the latter and tried to go to the home page, it said this. It's looking for a module "Hello", even though the Python package is always lowercase ("hello", aka "Hello/hello"). % paster serve development.ini Starting server in PID 6486. serving on 0.0.0.0:5000 view at http://127.0.0.1:5000 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 43651) Traceback (most recent call last): File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/paste/httpserver.py", line 1068, in process_request_in_thread self.finish_request(request, client_address) File "/usr/lib/python2.6/SocketServer.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.6/SocketServer.py", line 615, in __init__ self.handle() File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/paste/httpserver.py", line 442, in handle BaseHTTPRequestHandler.handle(self) File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle self.handle_one_request() File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/paste/httpserver.py", line 437, in handle_one_request self.wsgi_execute() File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/paste/httpserver.py", line 287, in wsgi_execute self.wsgi_start_response) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/router.py", line 127, in __call__ response = view_callable(context, request) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/configuration.py", line 2310, in _bfg_class_requestonly_view request=request) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/renderers.py", line 290, in render_to_response result = self.render(value, system_values, request=request) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/renderers.py", line 269, in render renderer = self.renderer File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/decorator.py", line 17, in __get__ val = self.wrapped(inst) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/renderers.py", line 253, in renderer return self.factory(self.renderer_name) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/mako/__init__.py", line 30, in renderer_factory directories = [ abspath_from_resource_spec(d) for d in directories ] File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/repoze/bfg/mako/__init__.py", line 79, in abspath_from_resource_spec return pkg_resources.resource_filename(pname, filename) File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py", line 862, in resource_filename return get_provider(package_or_requirement).get_resource_filename( File "/home/sluggo/exp/execution/workspace/venv/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg/pkg_resources.py", line 180, in get_provider __import__(moduleOrReq) ImportError: No module named Hello -- Mike Orr <sluggos...@gmail.com> -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-de...@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.