{ "info": { "author": "Dougal Matthews", "author_email": "dougal85@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Django appregister\n========================================\n\n.. image:: https://secure.travis-ci.org/saltstack/salt.png?branch=develop\n :target: http://travis-ci.org/d0ugal/django-appregister\n\nDjango appregister is a building blocks app to implement a class registry\nsystem for your django app. It uses a similar approach to the Django admin,\nallowing you to register classes and supports an autodiscover feature.\n\nA registry system that provides a good base for making an app plugable and\nextendable by third parties as they can register their own subclasses for\nUse within the main code base.\n\nInstallation\n========================================\n\nUse pip::\n\n pip install django-appregister\n\n\nQuick Example Usage\n========================================\n\nFirst, you should create your base class that all registered classes must be a\nsubclass of. Often this is a base Model class in your models.py or it can be\nanywhere in your project::\n\n >>> class AppPlugin(object):\n ... pass\n\nThen you need to create your own registry, the base can either be a class, or a\ndotted string that points to the base class, such as ``\"myapp.AppPlugin\"``.\nAfter that, you can go ahead and create an instance of the registry - creating\nit at the module level makes it easy to re-use across the project but you can\nhave as many instances as you need. It's good practice to create your registry\nin its own module, such as ``myapp/register.py``::\n\n >>> from appregister import Registry\n\n >>> class MyRegistry(Registry):\n ... base = AppPlugin\n ... discovermodule = 'plugins'\n\n >>> plugins = MyRegistry()\n\nNow that you have the registry, you can start to add subclasses to it. This can\nbe done by using the class decorator on your register::\n\n >>> @plugins.register\n ... class MyPlugin(AppPlugin):\n ... pass\n\nNote, If you are using version 2.5 or below of Python you can't use the class\nbased decorator, you will need to call it manually. The above example would\nthen become::\n\n >>> class MySecondPlugin(AppPlugin):\n ... pass\n >>> plugins.register(MySecondPlugin)\n \n\nRegistering an invalid object will raise an InvalidOperation exception::\n\n >>> # Note that this class does not inherit from the base we specified.\n >>> class MyNonSubclass(object):\n ... pass\n\n >>> plugins.register(MyNonSubclass)\n Traceback (most recent call last):\n ...\n InvalidOperation: Object 'MyNonSubclass' is not a subclass of 'AppPlugin'\n\nFinally, now you can get all your objects back - this includes those registered\nby a third party::\n\n >>> len(plugins)\n 2\n\n >>> for plugin in plugins:\n ... print plugin\n \n \n\nThe order of registration is not stored. Since we can't tell what order they\nwould be registered, if you want a sorted set you will need to sort them\nafter they have all been registered::\n\n >>> plugins.clear()\n >>> len(plugins)\n 0", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://appregsiter.readthedocs.org/", "keywords": null, "license": "appregister\n-----------------\nCopyright (c) 2012 appregister authors (see AUTHORS file)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "django-appregister", "package_url": "https://pypi.org/project/django-appregister/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-appregister/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://appregsiter.readthedocs.org/" }, "release_url": "https://pypi.org/project/django-appregister/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "A Django app that provides the building blocks for an app registry system", "version": "0.3.1" }, "last_serial": 789103, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "aa44ee35e0482865f25f0ab98bf3deb6", "sha256": "d1de0374133f2177c2d776b45af4508a80a07acffd1e164186086010aca7131d" }, "downloads": -1, "filename": "django-appregister-0.1.tar.gz", "has_sig": false, "md5_digest": "aa44ee35e0482865f25f0ab98bf3deb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4223, "upload_time": "2011-11-29T17:14:51", "url": "https://files.pythonhosted.org/packages/3e/96/090e24035da6e2af3569443c3778ef9c297f626eb7b125872bf7bf3dcb34/django-appregister-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "d8b245bf878aea1edc857a5d626de863", "sha256": "9a61377e2a757439a09a94a570c14ea4339e065010a4c6f807f50812770a0008" }, "downloads": -1, "filename": "django-appregister-0.2.tar.gz", "has_sig": false, "md5_digest": "d8b245bf878aea1edc857a5d626de863", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6713, "upload_time": "2011-12-07T10:42:31", "url": "https://files.pythonhosted.org/packages/bd/23/ff8ae73e8855cab6b7dfd4d312ab93dca6cf4fbe9a1eae9c998eb206f439/django-appregister-0.2.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "3d47187bd82ceea124e192ca7039a2f7", "sha256": "7642f166b9e864b37059927c426518fb971fa36d47274f412e2c06fa72b15d91" }, "downloads": -1, "filename": "django-appregister-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3d47187bd82ceea124e192ca7039a2f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7711, "upload_time": "2012-06-20T11:09:01", "url": "https://files.pythonhosted.org/packages/8e/45/b669c9e2e5b04132d99f0e6dab5c98b4a2a8aca498f61689e2857b85a529/django-appregister-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3d47187bd82ceea124e192ca7039a2f7", "sha256": "7642f166b9e864b37059927c426518fb971fa36d47274f412e2c06fa72b15d91" }, "downloads": -1, "filename": "django-appregister-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3d47187bd82ceea124e192ca7039a2f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7711, "upload_time": "2012-06-20T11:09:01", "url": "https://files.pythonhosted.org/packages/8e/45/b669c9e2e5b04132d99f0e6dab5c98b4a2a8aca498f61689e2857b85a529/django-appregister-0.3.1.tar.gz" } ] }