{ "info": { "author": "Nathan Van Gheem", "author_email": "vangheem@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Programming Language :: Python" ], "description": "Introduction\n============\n\nA routes implementation for Plone. What drives the route implementation\nis querying the portal catalog.\n\n\nExample Route::\n\t\n\t /posts/{effective:year}/{effective:month}/{effective:day}\n\n\nTo add a route::\n\t\n\t from collective.routes import addRoute\n\t addRoute('BlogItems',\n\t \t'/posts/{effective:year}/{effective:month}/{effective:day}',\n\t \tdefaultQuery={'portal_type': 'News Item'},\n allowPartialMatch=True)\n\n\nEnable it\n---------\n\nBefore the route is usable, you need to first enable the route\non the site you'd like to use it for. This can be done via\nthe route configuration panel in Site Setup.\n\n\nOut of the box routes\n---------------------\n\ncollective.routes has a couple example routes that\nit comes pre-packaged with.\n\nblog posts\n~~~~~~~~~~\n\nBlog Posts\n `/posts/{effective:year}/{effective:month}/{effective:day}`\n\nExmaple Urls::\n \n /posts/2011 ~ Show all posts from 2011\n /posts/2011/10 ~ Show all from 2011 and the month of October\n /posts/2011/10/5 ~ Show the blog posted October 5, 2011\n\nDefinition::\n\n addRoute('Blog Posts',\n '/posts/{effective:year}/{effective:month}/{effective:day}',\n defaultQuery={'portal_type': 'News Item',\n 'sort_on': 'effective',\n 'sort_order': 'reverse'},\n allowPartialMatch=True)\n\ntagged content\n~~~~~~~~~~~~~~\n\nTagged\n `/tagged/{Subject}/{Subject}/{Subject}`\n\nExample Urls::\n\n /tagged/foo ~ Show all posts tagged `foo`\n /tagged/foo/bar ~ Show all posts tagged `foo` and `bar`\n /tagged/foo/bar/woo ~ Show all posts tagged `foo`, `bar` and `woo`\n\nDefinition::\n\n addRoute('Tagged',\n '/tagged/{Subject}/{Subject}/{Subject}',\n defaultQuery={'portal_type': 'News Item',\n 'sort_on': 'effective',\n 'sort_order': 'reverse'},\n allowPartialMatch=True)\n\nRoute Syntax\n------------\n\nThe syntax is really basic and only has a few variations.\n\nLiteral\n~~~~~~~\n\nLiteral string match::\n\n /string-to-match\n\nWill match \"string-to-match\"\n\n\nQuery\n~~~~~\n\nMatch anything and maintain it as a query parameter::\n\n /{Subject}\n\nWill match any string and then keep the value as a query\nparameter to be used for a portal_catalog query.\n\n\nDate Query\n~~~~~~~~~~\n\nHas three sub-directives to match part parts::\n\n /{effective:year}/{effective:month}/{effective:day}\n\nWhich will then put together a query for the portal_catalog to\nuse.\n\n\nCustomize Object Retrieval\n--------------------------\n\nIf you'd prefer to bypass the normal portal_catalog query\nto retrieve your object, you can provide your own object\nfinder method.\n\nExample::\n\n def customObjectFinder(context, **kwargs):\n query = context.query\n site = getSite()\n return site[query['id']]\n\n addRoute('My Route',\n '/my-route/{id}',\n objectFinder=customObjectFinder)\n\n\nFiddle with published object\n----------------------------\n\nIf you'd like to be able to add interfaces at the last moment\nbefore the traversal is published, this is what you'd use.\n\nThis can be useful for adding interfaces since the actual \npublished object is wrapped so breadcrumbs are maintained\non publishing.\n\nExample::\n\n from interfaces import IMySpecialContext\n from zope.interface import alsoProvides\n\n def myMungeMethod(context):\n alsoProvides(context, IMySpecialContext)\n\n addRoute('My Route',\n '/foo/{bar}',\n mungeObject=myMungeMethod)\n\n\nCustomize view rendered\n-----------------------\n\nYou can customize the view that is rendered for the found\nobject also::\n\n addRoute('My Route',\n '/foo/{bar}',\n customViewName='@@custom-view')\n\n\naddRoute Signature\n------------------\n\nAllow arguments\n\nrouteName(required)\n Name of route\n\nroute(required)\n Actual route specification\n\ndefaultQuery(defaults to {})\n Default query to provide the finder with\n\nobjectFinder(defaults to collective.routes.finders.catalogObjectFinder)\n The method used to find the result published object\n\nmungeObject(defaults to None)\n Since the real published is a wrapper object, this is a method to\n be able to mess with the temporary wrapper object before \n publication\n\ncustomViewName(defaults to None)\n Custom view to render for the found object\n\nallowPartialMatch(defaults to False)\n If the whole url is not matched, you can still attempt to publish it.\n This can be useful for catalog finder routes where you want to allow\n the user to provide partial urls and still find objects.\n\nbreadcrumbFactory(defaults to None)\n Override breadcrumb generation. Must return a tuple of\n {'absolute_url': url, 'Title': title} values.\n\ncustomPredicates(defaults to [])\n An iterable of custom predicate functions(s) to check against the incoming request\n that they match. A predicate must take 2 parameters(`request`, `query`) where `request`\n is the current request object and `query` is the currently generated query\n from the route. The function must return a boolean. True if it matches, False it doesn't.\n\n\nChangelog\n=========\n\n1.1a2 (2014-08-29)\n------------------\n\n- Added Italian translation\n [giacomos]\n\n- Added some i18n strings and 2 script for i18n rebuild\n [giacomos]\n\n- plone 4.3 compat imports\n [Lewicki]\n\n1.1a1 (2012-02-28)\n------------------\n\n- Added Spanish and Brazilian Portuguese translations\n [hvelarde]\n\n- Move to using plone.app.registry\n [saibatizoku]\n\n- Make work with plone.locking\n [vangheem]\n\n- provide ability to specify the view to traverse to\n in route configuration\n [vangheem]\n\n- do not apply IWrappedContext interface\n [vangheem]\n\n- add IRoutedRequest layer dynamically to request when\n routing request so you can override specific parts of\n plone only when routed.\n [vangheem]\n\n- add ability to provide custom predicates\n [vangheem]\n\n- add ability to provide a custom breadcrumb factory\n [vangheem]\n\n- added addRoute parameter of allowPartialMatch so that\n you do not have to match an entire url when matching\n url against a route.\n [vangheem]\n\n\n1.0a1 (2011-10-07)\n------------------\n\n- Initial release", "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/collective/collective.routes", "keywords": "plone routes query path", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "collective.routes", "package_url": "https://pypi.org/project/collective.routes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.routes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/collective/collective.routes" }, "release_url": "https://pypi.org/project/collective.routes/1.1a2/", "requires_dist": null, "requires_python": null, "summary": "ability to add route configuration for plone", "version": "1.1a2" }, "last_serial": 1206661, "releases": { "1.0a1": [ { "comment_text": "", "digests": { "md5": "061408a8a6e683ffa161198c1f96443d", "sha256": "1f9552431de80bd1ff7c1823d6babc0e698ec71660a5f50e7f85e479934341d7" }, "downloads": -1, "filename": "collective.routes-1.0a1.zip", "has_sig": false, "md5_digest": "061408a8a6e683ffa161198c1f96443d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29792, "upload_time": "2011-10-07T06:47:36", "url": "https://files.pythonhosted.org/packages/4d/74/4e23ade57514d50050998fe0f69d650ab07a0945e74ebd4df3a83a747c18/collective.routes-1.0a1.zip" } ], "1.1a1": [ { "comment_text": "", "digests": { "md5": "8cc0a0b549fc2e02204bb36e6c240813", "sha256": "3ae3191de4cdeb1ea74dc823d489dc1c2758f6cb8092ac087b6d395f5ffa85eb" }, "downloads": -1, "filename": "collective.routes-1.1a1.zip", "has_sig": false, "md5_digest": "8cc0a0b549fc2e02204bb36e6c240813", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40536, "upload_time": "2012-02-28T22:33:36", "url": "https://files.pythonhosted.org/packages/f3/db/6a5c4a5a2b9ebc917125b9cbe34781fa8dc1f0468bddb6dffce89391dcf1/collective.routes-1.1a1.zip" } ], "1.1a2": [ { "comment_text": "", "digests": { "md5": "70ca807bbf7469dee30ccf6e4ab02593", "sha256": "fe2571c0771b7305d73f8b7725dbfd781baa5274c8ae9947914e029efca8845f" }, "downloads": -1, "filename": "collective.routes-1.1a2.zip", "has_sig": false, "md5_digest": "70ca807bbf7469dee30ccf6e4ab02593", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43852, "upload_time": "2014-08-29T14:50:35", "url": "https://files.pythonhosted.org/packages/90/88/ebb71258ea48582be6b0f2bdc8ef6191e6df4da590dbbb7343fbda2a7b3e/collective.routes-1.1a2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70ca807bbf7469dee30ccf6e4ab02593", "sha256": "fe2571c0771b7305d73f8b7725dbfd781baa5274c8ae9947914e029efca8845f" }, "downloads": -1, "filename": "collective.routes-1.1a2.zip", "has_sig": false, "md5_digest": "70ca807bbf7469dee30ccf6e4ab02593", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43852, "upload_time": "2014-08-29T14:50:35", "url": "https://files.pythonhosted.org/packages/90/88/ebb71258ea48582be6b0f2bdc8ef6191e6df4da590dbbb7343fbda2a7b3e/collective.routes-1.1a2.zip" } ] }