{ "info": { "author": "Aymeric Augustin", "author_email": "aymeric.augustin@m4x.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3" ], "description": "django-transaction-signals\n##########################\n\ntl;dr\n=====\n\nFor the common use case of running code after the current transaction is\nsuccessfully committed, use `django-transaction-hooks`__. It has some rough\nedges, but it's sane.\n\n__ https://django-transaction-hooks.readthedocs.org/\n\nWhy?\n====\n\nDjango doesn't provide transaction signals because they're a bad idea. Some of\nthe reasons will be apparent in the \"Limitations\" paragraph below. Other\nreasons can be found in ticket 14051__ and on the django-developers mailing\nlist. However, I'm fed up with having this argument. People will shoot\nthemselves into the foot anyway.\n\nThis package will help you experience the problems\nof transaction signals first-hand.\n\nUse it at your own risk. I wouldn't.\n\n__ https://code.djangoproject.com/ticket/14051\n\nHow?\n====\n\nAdd ``'transaction_signals'`` to your ``INSTALLED_APPS`` setting.\n\nThis will monkey-patch Django's transaction management features.\n\nYou can then register receivers for transaction signals::\n\n from django.dispatch import receiver\n from transaction_signals import post_commit\n\n @receiver(post_commit)\n def print_commits(sender, **kwargs):\n print(\"COMMIT on %s\" % sender)\n\nSignals\n=======\n\nSignals are available in the ``transaction_signals`` package. Their semantics\nare obvious, except when they aren't.\n\nConnection signals:\n\n- ``pre_open``\n- ``post_open``\n- ``pre_close``\n- ``post_close``\n\nAutocommit signals:\n\n- ``pre_set_autocommit``\n- ``post_set_autocommit``\n\nTransaction signals:\n\n- ``pre_commit``\n- ``post_commit``\n- ``pre_rollback``\n- ``post_rollback``\n\nSavepoint signals:\n\n- ``pre_savepoint``\n- ``post_savepoint``\n- ``pre_savepoint_commit``\n- ``post_savepoint_commit``\n- ``pre_savepoint_rollback``\n- ``post_savepoint_rollback``\n\n``sender`` is the alias of the database connection e.g. ``'default'``. All\nsignals pass the database connection in the ``'connection'`` argument.\nFurthermore, ``pre/post_open`` provide a ``conn_params`` argument,\n``pre/post_set_autocommit`` provide ``autocommit``, and\n``pre/post_savepoint/_commit/_rollback`` provide ``savepoint_id``.\n\nLimitations\n===========\n\nYou cannot assume that ``pre/post_commit`` are sent whenever changes are\ncommitted. Signals aren't sent when the connection is in autocommit mode,\nwhich is the default__.\n\nYou cannot assume that ``pre/post_rollback`` are sent whenever changes are\ncancelled. Closing the connection to the database triggers an implicit\nrollback.\n\nYou cannot assume that ``pre/post_close`` are sent whenever an implicit\nrollback happens. Losing the connection to the database also triggers an\nimplicit rollback.\n\nAfter ``pre/post_savepoint`` is sent, you cannot assume that either\n``pre/post_savepoint_commit`` or ``pre/post_savepoint_rollback`` will be sent\nwith the same ``savepoint_id``. The savepoint may be released or rolled back\ntogether with an earlier savepoint or the entire transaction.\n\nYou cannot use ``pre/post_set_autocommit`` on SQLite. The ``sqlite3`` module\ndoesn't work in non-autocommit mode.\n\nYou cannot use ``pre/post_savepoint_commit`` on Oracle, MSSQL, or any other\ndatabase that doesn't support releasing savepoints.\n\nThis is only the tip of the iceberg. I cannot recommend you use this package\nif you learnt anything in this section. In fact, I cannot recommend it at all.\n\n__ https://docs.djangoproject.com/en/stable/topics/db/transactions/\n\nAlternatives\n============\n\nFortunately, if you want to add custom logic to Django's transaction handling,\nyou have several alternatives. They're much less likely to result in anger,\nfacepalms, insanity, loss of self-esteem, and other regrettable side effects.\n\nYou may put your custom logic:\n\n* In a middleware, if you only care about transactions tied to requests when\n ``ATOMIC_REQUESTS`` is enabled.\n\n* In a decorator that wraps ``atomic``, if you have more advanced needs,\n especially if you want to track partial commits and rollbacks.\n\n* In a database backend, if you want tight control over database operations.\n Since there's no public API, you'll have to read the source and figure out\n how Django works, rather than blindly hooking to signals that may or may not\n be sent. django-transaction-hooks uses this technique.\n\nLicense\n=======\n\nThis package is released under a dual license: WTFPLv2 and GPLv2.\n\nThe distribution only includes the WTFPLv2 because the GPLv2 is too long.", "description_content_type": null, "docs_url": null, "download_url": "http://pypi.python.org/pypi/django-transaction-signals-do-not-use", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aaugustin/django-transaction-signals", "keywords": null, "license": "WTFPL", "maintainer": null, "maintainer_email": null, "name": "django-transaction-signals-do-not-use", "package_url": "https://pypi.org/project/django-transaction-signals-do-not-use/", "platform": "all", "project_url": "https://pypi.org/project/django-transaction-signals-do-not-use/", "project_urls": { "Download": "http://pypi.python.org/pypi/django-transaction-signals-do-not-use", "Homepage": "https://github.com/aaugustin/django-transaction-signals" }, "release_url": "https://pypi.org/project/django-transaction-signals-do-not-use/1.0/", "requires_dist": null, "requires_python": null, "summary": "Transaction signals for Django. Don't use this!", "version": "1.0" }, "last_serial": 1044843, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "6a53a385a52333fb5e824b6aa415e854", "sha256": "cffb535650ee3b2f8a349ba74501f1322ed0c52f62f4d937fbb7941d01ea6b57" }, "downloads": -1, "filename": "django_transaction_signals_do_not_use-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6a53a385a52333fb5e824b6aa415e854", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8760, "upload_time": "2014-01-11T21:07:45", "url": "https://files.pythonhosted.org/packages/7d/db/3381317c919d886e028fb07fbbf0f0d3d58ce5bee24f2f45cd669b94b9b0/django_transaction_signals_do_not_use-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9f912d145b52c8cce0994612f47afa0", "sha256": "e6ba25e2069b6a049cf10e766b990c479709d37614ff22d528078534877ba11e" }, "downloads": -1, "filename": "django-transaction-signals-do-not-use-1.0.tar.gz", "has_sig": false, "md5_digest": "a9f912d145b52c8cce0994612f47afa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5244, "upload_time": "2014-01-11T20:46:59", "url": "https://files.pythonhosted.org/packages/24/48/5c6ade056f6396ffb82a891014f8a8feb4660346df6ae3b774fa78cceafa/django-transaction-signals-do-not-use-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6a53a385a52333fb5e824b6aa415e854", "sha256": "cffb535650ee3b2f8a349ba74501f1322ed0c52f62f4d937fbb7941d01ea6b57" }, "downloads": -1, "filename": "django_transaction_signals_do_not_use-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6a53a385a52333fb5e824b6aa415e854", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8760, "upload_time": "2014-01-11T21:07:45", "url": "https://files.pythonhosted.org/packages/7d/db/3381317c919d886e028fb07fbbf0f0d3d58ce5bee24f2f45cd669b94b9b0/django_transaction_signals_do_not_use-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9f912d145b52c8cce0994612f47afa0", "sha256": "e6ba25e2069b6a049cf10e766b990c479709d37614ff22d528078534877ba11e" }, "downloads": -1, "filename": "django-transaction-signals-do-not-use-1.0.tar.gz", "has_sig": false, "md5_digest": "a9f912d145b52c8cce0994612f47afa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5244, "upload_time": "2014-01-11T20:46:59", "url": "https://files.pythonhosted.org/packages/24/48/5c6ade056f6396ffb82a891014f8a8feb4660346df6ae3b774fa78cceafa/django-transaction-signals-do-not-use-1.0.tar.gz" } ] }