I especially like the language support which will enable consistent bookmarking of urls. This all seems very good - thanks! -D
On Dec 31 2010, 10:36 pm, Jonathan Lundell <[email protected]> wrote: > I've been working on a new URL routing facility that provides fairly powerful > rewriting with very simple configuration and no regexes. The configuration is > described below. > > Features: > > * remove default application/controller names from URLs > > * support domain<->app mapping (no visible app names) > > * support language codes embedded in URLs: /app/en/ctlr/fcn/args > > * handle static files, including root-based files like favicon.ico, > automatically > > * make full URL-legal character set available for args and vars > (This was the original driver for making the changes, since it was > essentially impossible to > retrofit into the existing rewrite system. The secondary goal was to > address 99% of required > functionality while keeping configuration as close to trivial as possible.) > > * app-specific routing > > The new logic is selected in routes.py. The old regex logic remains > available, though not simultaneously. > > I'd like to get some feedback before submitting the patch, with respect to > the feature set especially: what's missing? > > Is the language support of use to anyone? It needs to be tied into the > existing header-driven language logic, but that should be relatively easy. > > # router is a dictionary of URL routing parameters. > # > # For each request, the effective router is the default router (below), > # updated by the base router (if any) from routes.py, > # updated by the relevant application-specific router (if any) > # from applications/app/routes.py. > # > # Optional members of base router: > # > # default_application: default application name > # applications: list of all recognized applications, > # or 'ALL' to use all currently installed applications > # map_domain: dict used to map domain names to application names > # > # These values may be overridden by app-specific routers: > # > # default_controller: name of default controller > # default_function: name of default function (all controllers) > # root_static: list of static files accessed from root > # (mapped to the selected application's static/ directory) > # > # > # Optional members of application-specific router: > # > # These values override those in the base router: > # > # default_controller > # default_function > # root_static > # > # When these appear in the base router, they apply to the default > application only: > # > # controllers: list of valid controllers in selected app > # or "DEFAULT" to use all controllers in the selected app plus 'static' > # or [] to disable controller-name omission > # languages: list of all supported languages > # default_language > # The language code (for example: en, it-it) optionally appears in the > URL following > # the application (which may be omitted). For incoming URLs, the code > is copied to > # request.language; for outgoing URLs it is taken from request.language. > # If languages=[], language support is disabled. > # The default_language, if any, is omitted from the URL. > # check_args: set to False to suppress arg checking > # request.raw_args always contains a list of raw args from the URL, not > unquoted > # request.args are the same values, unquoted > # By default (check_args=True), args are required to match r'([\w@ > -][=.]?)+$'. > # > # > # The built-in default router supplies default values (undefined members are > None): > # > # router = dict( > # default_application = 'init', > # default_controller = 'default', > # default_function = 'index', > # applications = 'ALL', > # controllers = 'DEFAULT', > # languages = [], > # default_language = None, > # root_static = ['favicon.ico', 'robots.txt'], > # check_args = True, > # map_domain = dict(), > # ) > # > # See rewrite.map_url_in() and rewrite.map_url_out() for implementation > details. > > # This simple router overrides only the default application name, > # but provides full rewrite functionality. > # > # router = dict( > # default_application = 'welcome', > # )

