{ "info": { "author": "Martijn Faassen", "author_email": "faassen@startifact.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Zope Public License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "ObjectPath\n**********\n\nThis package contains two things:\n\n* the ``z3c.objpath.interfaces.IObjectPath`` interface.\n\n* some helper functions to construct (relative) object paths, in\n ``z3c.objpath.path``.\n\nThe idea is that a particular application can implement a utility that\nfulfills the ``IObjectPath`` interface, so that it is possible to\nconstruct paths to objects in a uniform way. The implementation may be\ndone with ``zope.traversing``, but in some cases you want\napplication-specific object paths. In this case, the functions in\n``z3c.objpath.path`` might be useful.\n\nWe'll have a simple item::\n\n >>> class Item(object):\n ... __name__ = None\n ... __parent__ = None\n ... def __repr__(self):\n ... return '' % self.__name__\n\nLet's create a simple container-like object::\n\n >>> class Container(Item):\n ... def __init__(self):\n ... self._d = {}\n ... def __setitem__(self, name, obj):\n ... self._d[name] = obj\n ... obj.__name__ = name\n ... obj.__parent__ = self\n ... def __getitem__(self, name):\n ... return self._d[name]\n ... def __repr__(self):\n ... return '' % self.__name__\n\nNow let's create a structure::\n\n >>> root = Container()\n >>> root.__name__ = 'root'\n >>> data = root['data'] = Container()\n >>> a = data['a'] = Container()\n >>> b = data['b'] = Container()\n >>> c = data['c'] = Item()\n >>> d = a['d'] = Item()\n >>> e = a['e'] = Container()\n >>> f = e['f'] = Item()\n >>> g = b['g'] = Item()\n\nWe will now exercise two functions, ``path`` and ``resolve``, which\nare inverses of each other::\n\n >>> from z3c.objpath import path, resolve\n\nWe can create a path to ``a`` from ``root``::\n\n >>> path(root, a)\n '/root/data/a'\n\nWe can also resolve it again::\n\n >>> resolve(root, '/root/data/a')\n \n\nWe can also create a path to ``a`` from ``data``::\n\n >>> path(data, a)\n '/data/a'\n\nAnd resolve it again::\n\n >>> resolve(data, '/data/a')\n \n\nWe can make a deeper path::\n\n >>> path(root, f)\n '/root/data/a/e/f'\n\nAnd resolve it::\n\n >>> resolve(root, '/root/data/a/e/f')\n \n\nThe path `'/'` leads to the root object::\n\n >>> resolve(root, '/')\n \n\nWe get an error if we cannot construct a path::\n\n >>> path(e, a)\n Traceback (most recent call last):\n ...\n ValueError: Cannot create path for \n\nWe also get an error if we cannot resolve a path::\n\n >>> resolve(root, '/root/data/a/f/e')\n Traceback (most recent call last):\n ...\n ValueError: Cannot resolve path /root/data/a/f/e\n\nz3c.objpath changes\n*******************\n\n1.2 (2018-06-14)\n================\n\n* Add support for Python 3.5, 3.6, PyPy and PyPy3.\n\n1.1 (2012-10-13)\n================\n\n* Add name space declaration for `z3c`.\n\n* Added a `test` extra, as test require ``zope.testing``.\n\n1.0 (2008-04-15)\n================\n\n* Initial public release.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zopefoundation/z3c.objpath", "keywords": "Zope", "license": "ZPL", "maintainer": "", "maintainer_email": "", "name": "z3c.objpath", "package_url": "https://pypi.org/project/z3c.objpath/", "platform": "", "project_url": "https://pypi.org/project/z3c.objpath/", "project_urls": { "Homepage": "https://github.com/zopefoundation/z3c.objpath" }, "release_url": "https://pypi.org/project/z3c.objpath/1.2/", "requires_dist": null, "requires_python": "", "summary": "Generate and resolve paths to to objects.", "version": "1.2" }, "last_serial": 3960157, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "63641934441b255ebeeaeabc618f01ed", "sha256": "c197c268ef2e471064a6e5a119048b80eb5fb5e914ab539d94166c70a09bfe88" }, "downloads": -1, "filename": "z3c.objpath-1.0.tar.gz", "has_sig": false, "md5_digest": "63641934441b255ebeeaeabc618f01ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3546, "upload_time": "2008-04-15T11:26:46", "url": "https://files.pythonhosted.org/packages/eb/c4/b6a7bfeb50e83590f9bf5a3a7a94f63a61b164c9ff901f59c745907ed316/z3c.objpath-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "f55abd32ac3fd0d1a286539239369674", "sha256": "ed1017f59e45b03c1c05eb808312da6d999c3d7d08365bd9ef242810415499d6" }, "downloads": -1, "filename": "z3c.objpath-1.1.zip", "has_sig": false, "md5_digest": "f55abd32ac3fd0d1a286539239369674", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11491, "upload_time": "2012-10-13T16:55:31", "url": "https://files.pythonhosted.org/packages/ca/76/54de70f14b59c88fd83f7fd2ec2029a61673b7241c88ad313eaf4878df99/z3c.objpath-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "86058be9bc9d5631b1e732ce0641d595", "sha256": "bf314a07677542edc8971367e2fc7689e2db8c67b4e0d2b9ba42fa1ca2725cbe" }, "downloads": -1, "filename": "z3c.objpath-1.2.tar.gz", "has_sig": false, "md5_digest": "86058be9bc9d5631b1e732ce0641d595", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5517, "upload_time": "2018-06-14T06:11:02", "url": "https://files.pythonhosted.org/packages/73/03/81ba8dbbd59b518d6fc34cdaf8b7c8ea821362f13e0f5f43191778b0d10b/z3c.objpath-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "86058be9bc9d5631b1e732ce0641d595", "sha256": "bf314a07677542edc8971367e2fc7689e2db8c67b4e0d2b9ba42fa1ca2725cbe" }, "downloads": -1, "filename": "z3c.objpath-1.2.tar.gz", "has_sig": false, "md5_digest": "86058be9bc9d5631b1e732ce0641d595", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5517, "upload_time": "2018-06-14T06:11:02", "url": "https://files.pythonhosted.org/packages/73/03/81ba8dbbd59b518d6fc34cdaf8b7c8ea821362f13e0f5f43191778b0d10b/z3c.objpath-1.2.tar.gz" } ] }