{ "info": { "author": "Alessandro Molina", "author_email": "alessandro.molina@axant.it", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: TurboGears", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "About tgext.routes\n------------------\n\n.. image:: https://travis-ci.org/TurboGears/tgext.routes.png\n :target: https://travis-ci.org/TurboGears/tgext.routes\n\n.. image:: https://coveralls.io/repos/TurboGears/tgext.routes/badge.png\n :target: https://coveralls.io/r/TurboGears/tgext.routes\n\n.. image:: https://img.shields.io/:license-mit-blue.svg?style=flat-square\n :target: https://pypi.python.org/pypi/tgext.routes\n\ntgext.routes provides a simple way to integrate routes based dispatch\ninto TurboGears2 applications.\n\nInstalling\n----------\n\ntgext.routes can be installed both from pypi or from bitbucket::\n\n pip install tgext.routes\n\nshould just work for most of the users\n\nRouting Single Actions\n----------------------\n\nRoutes matching is done through the ``@route`` decorator,\neach exposed method can be bound to one or multiple routes.\n\nThe only requirement is that you inherit from the ``RoutedController`` instance.\n\nAll routes registered through the ``@route`` decorator are registered starting\nfrom the controller mount point.\n\nThe following example registers the ``entry_by_date`` method for urls like\n**/date/2012-01** and **/date/2012-01-01**::\n\n from tgext.routes import RoutedController, route\n\n class DateController(RoutedController):\n @expose()\n @route('{year}-{month}', day=33)\n @route('{year}-{month}-{day}')\n def entry_by_date(self, year, month, day):\n return '%s ++ %s ++ %s' % (year, month, day)\n\n class RootController(BaseController):\n date = DateController()\n\n @expose()\n def index(self):\n return 'Hello!'\n\nKeep in mind that as ``@expose`` wraps it, the method is still\naccessible through *ObjectDispatch* routing, ``@route`` can just\nregister additional routes.\n\nIf there is a route pointing to it, also actions that do not provide\nan ``@expose`` decoration are resolved, keep in mind that in that case\nyou will have to render template manually.\n\nIn case you want to disable *ObjectDispatch* you can set ``disable_objectdispatch=True``\ninside the controller. Keep in mind that it will disable *ObjectDispatch* for the\nwhole controller and so you won't be able to dispatch actions that do not provide\na route from that controller on.\n\nRouting Whole application\n-------------------------\n\n``RoutedController`` can also be mounted as the application *RootController*.\nIn that case instead of using the ``@route`` decorator you can even provide\na ``routes.Mapper`` object as controller ``mapper`` attribute and register\nall the routes of your application::\n\n class RootController(RoutedController):\n mapper = Mapper()\n mapper.connect('/', controller='home', action='index')\n mapper.connect('/json', controller='home', action='jsonexposed')\n mapper.connect('/unex', controller='home', action='unexposed')\n\nIn this case the ``controller`` argument is required and controller will be looked\nup inside the path specified by ``tg.config['paths']['controllers']``. In the previous\nexample a ``HomeController`` class will be looked for into the ``home.py`` module to\nserve the */*, */json* and */unex* paths through its ``index``, ``jsonexposed`` and\n``unexposed`` methods.\n\nIn case both a ``mapper`` attribute and ``@route`` decorator are used inside the same\n``RoutedController``, the ``@route`` decorator is applied after the mapper routes.\n\nFor more documentation about routes refer to `Routes Documentation `_\n\nContinuing with ObjectDispatch\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nWhen using tgext.routes as the primary routing method it is possible to tell\nit to continue with ObjectDispatch (or any specific dispatch method provided\nby the target controller) using `_dispatch` as the `action` of the route.\n\nBy default as routes are matched exactly providing a `_dispatch` action will\nprovide no remainder, so it will only dispatch to `index` method of the target controller.\nTo continue dispatching with a remaining part of the url you can use an\n`_dispatch` label::\n\n mapper.connect('/forsub{_dispatch:.*?}', controller='home', action='_dispatch')\n\nThis will dispatch to `HomeController` continuing with ObjectDispatch for anything\nthat cames after `/forsub` part of the url.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/TurboGears/tgext.routes", "keywords": "turbogears2.extension", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "tgext.routes", "package_url": "https://pypi.org/project/tgext.routes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tgext.routes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/TurboGears/tgext.routes" }, "release_url": "https://pypi.org/project/tgext.routes/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Routes based dispatching for TurboGears2", "version": "0.2.0" }, "last_serial": 2348846, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "434c7b4bb30f7d33d0d5e64427dc2778", "sha256": "ca04c572fae130c1233cfdfc60d713b37c821225540018272003cf753dac05a6" }, "downloads": -1, "filename": "tgext.routes-0.0.1.tar.gz", "has_sig": false, "md5_digest": "434c7b4bb30f7d33d0d5e64427dc2778", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2876, "upload_time": "2013-02-27T01:06:40", "url": "https://files.pythonhosted.org/packages/bd/30/aebaf9ff183eb4be265a87a9608b12b7fa2e824d4ef168486ef85cd90ff9/tgext.routes-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "4493ee549e6c4123900300964d2a7661", "sha256": "14392b7a77960ba2aedf2de5fb3e3537b411a708f21acde0b20fe3347ed1b8e0" }, "downloads": -1, "filename": "tgext.routes-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4493ee549e6c4123900300964d2a7661", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7736, "upload_time": "2016-03-06T22:21:02", "url": "https://files.pythonhosted.org/packages/91/65/067833b5974c9755da73a907b2259abcdd5ae7de0e0b158c96b3257cd6ac/tgext.routes-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "036c5ea70511c3ae96edf962dfc74cda", "sha256": "2ce69e7d4e85943869152cc0f5ac1dc0ab65ba7754520044480cde06d9d64c37" }, "downloads": -1, "filename": "tgext.routes-0.1.1.tar.gz", "has_sig": false, "md5_digest": "036c5ea70511c3ae96edf962dfc74cda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5214, "upload_time": "2016-03-13T20:45:58", "url": "https://files.pythonhosted.org/packages/62/d2/aa160bbcf155d093a3a4986060e1b1b6312c0f41d85e8642c25b15cce6b3/tgext.routes-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e8cf6430412ec0ff6a42b8cdd2da1a87", "sha256": "e009afbacc6a9c6238677f4e0bced7ab2a2536b97e9c3ccb37f644ac4df89c07" }, "downloads": -1, "filename": "tgext.routes-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e8cf6430412ec0ff6a42b8cdd2da1a87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5312, "upload_time": "2016-04-05T23:28:04", "url": "https://files.pythonhosted.org/packages/90/0c/9e02fcb4ad0065f382265bb6a5905a9e516d276a346661964d961a6f39e9/tgext.routes-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "98053042b13b22d64304c3f9fb432270", "sha256": "8a010b40acc7e4b333d606b6b3c4d9ca66c2b920a1acbb6ef82572c37d939ee8" }, "downloads": -1, "filename": "tgext.routes-0.1.3.tar.gz", "has_sig": false, "md5_digest": "98053042b13b22d64304c3f9fb432270", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5423, "upload_time": "2016-04-25T08:00:26", "url": "https://files.pythonhosted.org/packages/14/81/b62b8d0249a9f70eed5d2a75a674b3ac17e1b15ff57eb23eda60652b763f/tgext.routes-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "34b78875b42d0909d93d9c3c328fa12a", "sha256": "865a0cddb25ef7797be76308ba303e489eddd4de37acb3333177fad608815a64" }, "downloads": -1, "filename": "tgext.routes-0.2.0.tar.gz", "has_sig": false, "md5_digest": "34b78875b42d0909d93d9c3c328fa12a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5831, "upload_time": "2016-09-18T09:18:32", "url": "https://files.pythonhosted.org/packages/f1/b3/ea8dcb24786055edebe339a64ca5234ede20b427494ac71be4c2268ef187/tgext.routes-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "34b78875b42d0909d93d9c3c328fa12a", "sha256": "865a0cddb25ef7797be76308ba303e489eddd4de37acb3333177fad608815a64" }, "downloads": -1, "filename": "tgext.routes-0.2.0.tar.gz", "has_sig": false, "md5_digest": "34b78875b42d0909d93d9c3c328fa12a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5831, "upload_time": "2016-09-18T09:18:32", "url": "https://files.pythonhosted.org/packages/f1/b3/ea8dcb24786055edebe339a64ca5234ede20b427494ac71be4c2268ef187/tgext.routes-0.2.0.tar.gz" } ] }