{ "info": { "author": "Zope Foundation and Contributors", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "cipher.background\n=================\n\nA library for creating background threads that can talk to the ZODB and use\nlocal site components.\n\nWe're probably reinventing Celery.\n\n\nExample\n-------\n\nLet's assume we have a DMS with a simple publication workflow. We\nhave two states \"DRAFT\" and \"PUBLISH\". The Problem in this example\nis: that the transition form \"DRAFT\" to \"PUBLISH\" takes some minutes,\nand we don't want the user to be waiting.\n\nFirst we have create a WorkflowTransition-BackgroundThread:\n\n.. code-block:: python\n\n class MyWorkflowTransition(BackgroundWorkerThread):\n execute = True\n description = \"background worker thread (%(class_name)s) for %(site_name)s User %(user_name)s\"\n\n def __init__(self, site_db, site_oid, site_name, user_name, daemon=True, object_oid=None):\n self.object_oid = object_oid\n super(MyWorker, self).__init__(site_db, site_oid, site_name, user_name, daemon=True)\n\n def scheduleNextWork(self):\n return self.execute\n\n def getObjectFromOID(self):\n conn = getSite()._p_jar\n return conn.get(self.object_oid)\n\n def doWork(self):\n sleep(15) # This is our long TASK\n self.execute = False\n document = self.getObjectFromOID()\n document.wf_status = \"PUBLISHED\"\n\n\nWe have a simple Document with an initial Workflow-State draft.\n\n.. code-block:: python\n\n class Document(Persistent):\n wf_state = \"DRAFT\"\n\n\nNow we have to call our WorkflowTransition.\n\n.. code-block:: python\n\n def setWorkflow(site, document_oid, user_name):\n worker = MyWorkflowTransition(\n site_db = site._p_jar.db(), \n site_oid = site._p_oid,\n site_name = site.__name__,\n user_name = user_name,\n object_oid = document_oid,\n )\n worker.start()\n\nWhen calling worker.start() the thread goes into \"Background\" and the user\ndon't have to wait until the Transition is finished.\n\n\n\n=======\nCHANGES\n=======\n\n\n1.0.2 (2012-07-31)\n------------------\n\n- Refactor BackgroundWorkerThread to have the site returned from getSite()\n\n\n1.0.1 (2012-04-05)\n------------------\n\n\n1.0.0 (2012-02-10)\n------------------\n\n- Initial release as a separate package.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/cipher.background/", "keywords": "CipherHealth background thread ZODB", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "cipher.background", "package_url": "https://pypi.org/project/cipher.background/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cipher.background/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/cipher.background/" }, "release_url": "https://pypi.org/project/cipher.background/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "Background thread support with ZODB support", "version": "1.0.2" }, "last_serial": 787407, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "a0c75e87b21cc07cc4b40d8b64c3fcaf", "sha256": "5e06ebef0428ba04c3b1d7eb74ec4cd1ec103e8fcf11a817459d282254e70bb5" }, "downloads": -1, "filename": "cipher.background-1.0.1.tar.gz", "has_sig": false, "md5_digest": "a0c75e87b21cc07cc4b40d8b64c3fcaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13455, "upload_time": "2012-04-05T15:17:17", "url": "https://files.pythonhosted.org/packages/71/1b/8e82f3a507a3f9ae0a5749dd552ca1b7879906869ce3867755bc84f4aa3a/cipher.background-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "12d0f7202e3ff2bf35077693483af6e8", "sha256": "067f1bc9377689be5304bf69643555a31aa9c3b4d82dfe964cd3aee0ce468184" }, "downloads": -1, "filename": "cipher.background-1.0.2.tar.gz", "has_sig": false, "md5_digest": "12d0f7202e3ff2bf35077693483af6e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14574, "upload_time": "2012-08-02T10:01:32", "url": "https://files.pythonhosted.org/packages/a0/c4/52e17b517981e66a62b249cffcd820055c0660b9477bb3cfb5b4af598e8c/cipher.background-1.0.2.tar.gz" } ], "2.0.0a1": [ { "comment_text": "", "digests": { "md5": "88aece1a01345b33659a144317a26602", "sha256": "081b3d5d5011bc08f97d072e7042613b4f87ded28ef3bd52c44b03834990d267" }, "downloads": -1, "filename": "cipher.background-2.0.0a1.zip", "has_sig": false, "md5_digest": "88aece1a01345b33659a144317a26602", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21308, "upload_time": "2013-03-06T17:21:50", "url": "https://files.pythonhosted.org/packages/03/db/37021501c9f7541a9a6734541bd4ddbc82f989fa5eaca3fb0a30858c1544/cipher.background-2.0.0a1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "12d0f7202e3ff2bf35077693483af6e8", "sha256": "067f1bc9377689be5304bf69643555a31aa9c3b4d82dfe964cd3aee0ce468184" }, "downloads": -1, "filename": "cipher.background-1.0.2.tar.gz", "has_sig": false, "md5_digest": "12d0f7202e3ff2bf35077693483af6e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14574, "upload_time": "2012-08-02T10:01:32", "url": "https://files.pythonhosted.org/packages/a0/c4/52e17b517981e66a62b249cffcd820055c0660b9477bb3cfb5b4af598e8c/cipher.background-1.0.2.tar.gz" } ] }