{ "info": { "author": "Chris Beaven", "author_email": "smileychris@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=============\nDjango Notify\n=============\n\nA Django application which provides temporary notifications.\n\nNotification messages persist until a request retrieves them.\n\n\nInstallation\n============\n\nAdd the middleware to your ``MIDDLEWARE_CLASSES`` setting (the default\ntemporary storage relies on Django's ``contrib.sessions`` application, so place\nthis after ``SessionMiddleware``)::\n\n 'django_notify.middleware.NotificationsMiddleware',\n\nTo make it easy to access notifications in templates, add the context processor\ninto your ``TEMPLATE_CONTEXT_PROCESSORS`` setting::\n\n 'django_notify.context_processors.notifications',\n\n\nUsage\n=====\n\nAdding a notification message\n-----------------------------\n\nThe middleware attaches an instance of a temporary storage class called\n``notifications`` to your ``request``. To add a notification, call::\n\n request.notifications.add('Hello world.')\n\nSome other methods provide a standard way to add notifications with commonly\nused tags (which are usually represented as HTML classes for the message)::\n\n request.notifications.debug('%s SQL statements were executed.' % count)\n request.notifications.success('Profile details updated.')\n request.notifications.warning('Your account expires in three days.')\n request.notifications.error('Document deleted.')\n\n\nDisplaying notification messages\n--------------------------------\n\nIn your template, use something like::\n\n\t{% if notifications %}\n\t
\n\t{% endif %}\n\nIf you're using the context processor, your template should be rendered with a\n``RequestContext``. Otherwise, ensure ``request.notifications`` is available to\nthe template context.\n\n\nExpiration of notification messages\n-----------------------------------\n\nThe notifications are marked to be cleared when the storage instance is\niterated (and cleared when the response is processed).\n\nTo avoid the notifications being cleared, you can set\n``request.notifications.used = False`` after iterating.\n\n\nNotification Levels\n-------------------\n\nThe ``NOTIFICATIONS_LEVEL`` setting can be used to change the minimum recorded\nlevel. Attempts to add notifications of a level less than this will be ignored.\n\nThe built-in levels (which can be imported from ``django_notify`` directly)\nare:\n\n=========== ===== ===========\nConstant Level Default Tag\n=========== ===== ===========\n``DEBUG`` 10 ``debug``\n``INFO`` 20 \n``SUCCESS`` 25 ``success``\n``WARNING`` 30 ``warning``\n``ERROR`` 40 ``error``\n=========== ===== ===========\n\n``INFO`` is the default minimum recorded level. It is also the\ndefault level of the ``add`` method.\n\nThe minimum recorded level can also be set per request by changing the\n``level`` attribute of the notifications storage instance::\n\n import django_notify\n \n # Change the notifications level to ensure the debug message is added.\n request.notifications.level = django_notify.DEBUG\n request.notifications.debug('Test notification...')\n \n # Set the notifications level back to default.\n request.notifications.level = None\n\n\nCustom Tags\n-----------\n\nTo provide custom tags for notification levels (either built in levels or\ncustom ones), set the ``NOTIFICATIONS_TAGS`` setting to a dictionary\ncontaining the levels you wish to change. As this extends the default tags,\nyou only need to provide tags for the levels you wish to override::\n\n import django_notify\n NOTIFICATIONS_TAGS = {\n django_notify.INFO: 'info',\n 50: 'critical',\n }\n\nFor more direct control over message tags, you can optionally provide a string\ncontaining extra tags to any of the add methods::\n\n request.notifications.add('Over 9000!', extra_tags='dragonball')\n request.notifications.error('Email box full', extra_tags='email')\n\nExtra tags are added before any default tag for that level (space separated).\n\n\nTemporary Storage Backends\n==========================\n\nDjango notify can use different backends to store temporary messages. To change\nwhich backend is being used, add a ``NOTIFICATIONS_STORAGE`` to your settings,\nreferencing to the module and class of the storage class. For example::\n\n NOTIFICATIONS_STORAGE = 'cookie.CookieStorage'\n\nDjango Notify first looks for the module inside of ``django_notify.storage``,\nand if not found, tries to import the full given module directly.\n\nThree temporary storage classes are included in Django Notify:\n\n``'session.SessionStorage'``\n This class stores all messages inside of the request's session. It\n requires Django's ``contrib.session`` application.\n\n``'cookie.CookieStorage'``\n This class stores the notification data in a cookie (signed with a secret\n hash to prevent manipulation) to persist notifications across requests.\n Old messages are dropped if the cookie data size would exceed 4096 bytes.\n\n``'fallback.FallbackStorage'``\n This is the default temporary storage class.\n\n This class uses CookieStorage for all notification messages, falling back\n to using SessionStorage for the messages which could not fit in a single\n cookie.\n\n Since it is uses SessionStorage, it also requires Django's\n ``contrib.session`` application. \n\nTo write your own, subclass the ``BaseStorage`` class in\n``django_notify.storage.base`` and write ``_get`` and ``_store`` methods.", "description_content_type": null, "docs_url": null, "download_url": "http://code.google.com/p/django-notify/source/checkout", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/django-notify/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-notify", "package_url": "https://pypi.org/project/django-notify/", "platform": "any", "project_url": "https://pypi.org/project/django-notify/", "project_urls": { "Download": "http://code.google.com/p/django-notify/source/checkout", "Homepage": "http://code.google.com/p/django-notify/" }, "release_url": "https://pypi.org/project/django-notify/1.1.2/", "requires_dist": null, "requires_python": null, "summary": "A Django application which provides temporary notifications.", "version": "1.1.2" }, "last_serial": 790177, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "aebb641425e051fd44940bbcc7177da6", "sha256": "f5dd2d7ce86d849c45fedcc80f62005976a1d9ae6ab53c2d85fe638fb6bf5697" }, "downloads": -1, "filename": "django-notify-1.0.1.tar.gz", "has_sig": false, "md5_digest": "aebb641425e051fd44940bbcc7177da6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8851, "upload_time": "2009-09-15T11:32:29", "url": "https://files.pythonhosted.org/packages/d3/34/d3ea2ad3e94f0972972a70f01a397cf8ed2bd7d321eb492a52cbe7f51ef4/django-notify-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "e22051c1eb7c3f843d0169c4fd2f3380", "sha256": "4a86926344eb2fa04ee39555f0018b607ddcb11f37d215d111a7380ccbedbfa9" }, "downloads": -1, "filename": "django-notify-1.0.2.tar.gz", "has_sig": false, "md5_digest": "e22051c1eb7c3f843d0169c4fd2f3380", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9304, "upload_time": "2009-10-12T00:59:03", "url": "https://files.pythonhosted.org/packages/c8/46/ad97257b0aa9edd2ad3a8ea363c6ff5b841abdb0ba1285ee76afc17b293b/django-notify-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "6d5501a7e4e804a0e81aa8d4b0747f2b", "sha256": "3b14dbb96c2c0f71ffa851ab1594cb930468a96282ab379352f3827256ca592e" }, "downloads": -1, "filename": "django-notify-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6d5501a7e4e804a0e81aa8d4b0747f2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9313, "upload_time": "2009-10-12T03:26:29", "url": "https://files.pythonhosted.org/packages/35/77/105c7942b26b0b4d3fc7d61ca7834888949a1b481d7bb7444d1ec60f276e/django-notify-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "21a897aa1b2eb13304c1fe739392e588", "sha256": "e848a18ef5105382f42488cfca6431e93e7425c13a5cda7be2e5267bee900bca" }, "downloads": -1, "filename": "django-notify-1.1.0.tar.gz", "has_sig": false, "md5_digest": "21a897aa1b2eb13304c1fe739392e588", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11374, "upload_time": "2009-10-13T05:55:49", "url": "https://files.pythonhosted.org/packages/2b/5c/2bfc3693550a2588e6b7c292c4ffbf62d10dc2197f03294f95e374a66f7e/django-notify-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "a901d51935fb0be74e2f7fab62cd70e0", "sha256": "c025a7622a479231ad8c36d4e06ba7f22f7b9454c53aa17303cc15578a9914b6" }, "downloads": -1, "filename": "django-notify-1.1.1.tar.gz", "has_sig": false, "md5_digest": "a901d51935fb0be74e2f7fab62cd70e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12732, "upload_time": "2009-10-22T06:28:35", "url": "https://files.pythonhosted.org/packages/3f/c6/8237c0bcb57446b616f9e7d0cdf6d240534fca9d29aef26f5378b412253f/django-notify-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "5f6d9419bad678b8cd7d20bdd7cf5ce7", "sha256": "8bb9b5c5f57270071095e5d07d2a61891cf6d34af9acaafd893fa6bb67407db3" }, "downloads": -1, "filename": "django-notify-1.1.2.tar.gz", "has_sig": false, "md5_digest": "5f6d9419bad678b8cd7d20bdd7cf5ce7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12734, "upload_time": "2009-10-29T01:45:41", "url": "https://files.pythonhosted.org/packages/c9/b7/99804f01352703334122ccf4993d7caa6e5f4b2971b9fd2dea1494fb24b2/django-notify-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f6d9419bad678b8cd7d20bdd7cf5ce7", "sha256": "8bb9b5c5f57270071095e5d07d2a61891cf6d34af9acaafd893fa6bb67407db3" }, "downloads": -1, "filename": "django-notify-1.1.2.tar.gz", "has_sig": false, "md5_digest": "5f6d9419bad678b8cd7d20bdd7cf5ce7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12734, "upload_time": "2009-10-29T01:45:41", "url": "https://files.pythonhosted.org/packages/c9/b7/99804f01352703334122ccf4993d7caa6e5f4b2971b9fd2dea1494fb24b2/django-notify-1.1.2.tar.gz" } ] }