[Subversion] / WebHaiku / web_haiku.py |
No default branch
Bookmark a link to HEAD:
(view)
(download)
(as text)
Use Contextual for database services
Support dotted identifiers in templates, so you don't have to use $(? ?) for simple attribute access.
More new features * Redirector objects redirect to a URL with embedded vars or expressions * @expose makes normal functions into subpages, ala Template.page() * More tests, docs
More doc and tests, support query string in auto-redirects, and sort 'Allow' methods (so doctests are stable).
New features and bug fixes: * Added a ``test()`` function to make it easy to doctest any WSGI app * Improved debug support for ``EvalMap`` -- previously, pdb could crash if you inspected the stack while evaluating a template expression. * Improved HEAD method that should correctly compute Content-Length for any WSGI app, even ones that use write(). * Fixed cgi.escape not working as a method (it needed to be a staticmethod) * Added some preliminary doctests to README.txt (need refactoring and some actual docs!)
Don't make form vars visible attributes unless explicitly declared (via form_defaults).
Make cgi.escape a method of pages, and add debugging info to EvalMap KeyErrors.
Compute page's URL once, w/out including any subpath traversal.
More new features: * page.URL returns the page's URL * page.query() now returns an iterator of rows; you can still get a database cursor via page.cursor(). The yielded row objects from query() are just plain old objects with attributes corresponding to the result's field names.
Fix infinite redirect if a leaf page is the website root.
More features, less cruft... * @validator is now @form_handler, and it can also be used as @form_handler(priority) to put the handlers in a priority order. Each handler can return a WSGI response (in which case handling is terminated) or None (in which case handler invocation continues). When all handlers have been called, either self.form_failure() or self.form_success() are invoked, according to whether self.errors is empty. * The Form class is no longer needed. POST handling is automatically supported if any @form_handler methods are defined. To support GET forms, add:: body = Page.POST to your class, and GET handling will be identical to POST handling. * self.parse_form() now returns the form data, but will only do the parsing once. All pages can now have autogenerated attributes from the form_data FieldStorage and the form_defaults dictionary.
Bug fixes, refactoring, and new features: * Container is gone; the framework now automatically detects containerness if you override handle_child or define sub-pages. So everything is now either a Page or a Form. * Trailing-'/' redirection now goes both ways, according to whether a page is a container or not. * Page.__init__ accepts keyword arguments to set class-defined attributes at creation. This is useful for containers that invoke dynamic subpages in handle_child(). * An extensible setup() method is provided for subclass-specific initialization, prior to go() being invoked. * Template expressions can now reference the module globals of the module where the template was created. * Pages can have a ``body`` attribute (a template or WSGI-return method) which will be invoked for GET requests. * HEAD requests are now only handled if GET is supported (i.e., if a ``body`` is defined), and the wrapping of GET is a bit cleaner. * If you define a ``db_connect()`` method returning a DBAPI connection object, you can use the ``query()`` method to do SQL queries, and your subpages will automatically "inherit" the database connection from their parent pages/container(s). Not bad for <550 lines!
Quick-and-dirty ultra-light WSGI-based microframework. The main design goals are to minimize the footprint for installation requirements, memory use, and startup time. So all it does is dispatch and templating; the templates are basically souped-up string.Template objects with some limited expression capabilities, but arbitrary TG/Buffet template engines are also supported, and the template mechanism supports creating templates from egg resources (e.g. foo = HTML(resource="foo.html")) that are adjacent to the invoking module. There is also some very basic form parsing and validation support. More features may be added as I need them... or not.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |