{ "info": { "author": "NetAngels", "author_email": "info@netangels.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Django session attachments\n=============================\n\nThis app aims to work with attachments in Django.\n\nBasically working with attachments is the same as working with ordinary\nuploads, except for a few distinctions:\n\n- Attachments \"belong\" to clients they have uploaded. In other words,\n attachments must be private and inaccessible to public.\n- Attachments are organized to \"bundles\". It makes sense if your client decides\n to work with different attachment sets in different parts of your application\n (for example, he/she writes several emails or requests simultaniously and\n obviously doesn't want to share his/her attachments between recipients.)\n- Attachments are temporary. There must be easy methods to remove attachments\n manually or by expiration.\n- Attachments must be usable even for unauthenticated users. It is due to our\n specifics. This is also the main reason why we created this app.\n- It is impossible to store two attachments with the same name in the same\n bundle. New attachment overwrite previous one. It looks like sane\n restriction given application usecase.\n\n\nInstallation and configuration\n----------------------------------\n\nInstall application from PyPI or GitHub::\n\n $ pip install django-session-attachments # or\n $ pip install git://github.com/NetAngels/django-session-attachments.git#egg=django-session-attachments\n\n\nAdd a new application to your settings file::\n\n INSTALLED_APPS = [\n 'django.contrib.staticfiles',\n ...\n 'session_attachments',\n ...\n ]\n\nInclude a new line to your urlconf (urls.py)::\n\n urlpatterns = patterns('',\n ...\n url(r'^attachments/', include('session_attachments.urls')),\n ...\n )\n\n\n\nThere is a separate Django model to save attachments, so you should type::\n\n ./manage.py syncdb session_attachments\n\n\n\nHow to use it\n----------------\n\nProviding that your app is available at localhost:8000, you get following\nnumber of URLs to work with from your frontend. It would probably be easier to\nwork with the backend asynchronously, using JQuery forms extension or something\nsimilar.\n\nSamples below use curl for the sake of simplicity. Because attachments are tied\nwith session, it is important to keep session cookies between curl invocations.\nWe do it by passing ``--cookie session.txt --cookie-jar session.txt`` options to\ncurl.\n\nPlease note that curl examples don't work unless the CSRF middleware is\ndisabled in settings.\n\n\nUpload files to the the bundle\n````````````````````````````````\n\n\nTo upload files POST data to ``/attachments//`` URL. The form must\ncontain at least one file field. The name of file fields can be arbitrary as they\nare ignored by the app::\n\n $ echo spam > spam.txt\n $ echo egg > egg.txt\n $ curl --cookie session.txt --cookie-jar session.txt -F attach1=@spam.txt -F attach2=@egg.txt -X POST http://localhost:8000/attachments/foo/\n [{\"name\": \"egg.txt\", ...}, {\"name\": \"spam.txt\", ...}]\n\n\nGet the list of attachments in the bundle\n`````````````````````````````````````````````\n::\n\n $ curl --cookie session.txt --cookie-jar session.txt -X GET http://localhost:8000/attachments/foo/\n $ [{\"mimetype\": \"text/plain\", \"size\": 4, \"name\": \"egg.txt\", \"created\": \"2011-12-29 04:12\"}, {\"mimetype\": \"text/plain\", \"size\": 5, \"name\": \"spam.txt\", \"created\": \"2011-12-29 04:12\"}]\n\nThe list of dicts in JSON format is returned.\n\nDownload the file from the bundle\n``````````````````````````````````````\n\n::\n\n $ curl --cookie session.txt --cookie-jar session.txt -X GET http://localhost:8000/attachments/foo/spam.txt/\n spam\n\n\nDelete the attachment from the bundle\n``````````````````````````````````````\n\n::\n\n $ curl --cookie session.txt --cookie-jar session.txt -X POST http://localhost:8000/attachments/foo/spam.txt/delete/\n [true]\n\n\nClean up the whole bundle\n``````````````````````````````````````\n\n::\n\n $ curl --cookie session.txt --cookie-jar session.txt -X POST http://localhost:8000/attachments/foo/delete/\n [[true]]\n\n\nManagement command to cleanup outdated attachments\n````````````````````````````````````````````````````\n\nThere is a management command which removes \"outdated\" attachments from the\nbundle. To set up the threshold to remove You can pass the number of days::\n\n ./manage.py remove_outdated_attachments --older-than=3", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/NetAngels/django-session-attachments", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-session-attachments", "package_url": "https://pypi.org/project/django-session-attachments/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-session-attachments/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/NetAngels/django-session-attachments" }, "release_url": "https://pypi.org/project/django-session-attachments/0.2/", "requires_dist": null, "requires_python": null, "summary": "Django app to handle attachments (temporary uploads) grouped by sessions and bundles. Even for anonymous users", "version": "0.2" }, "last_serial": 790579, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "4d8ab9fbabbac61cb8d87c28a4abecfa", "sha256": "72e010f01dc91a24a01687bc010df4de74c7b4865b2a10d49d20a09836213db5" }, "downloads": -1, "filename": "django-session-attachments-0.2.tar.gz", "has_sig": false, "md5_digest": "4d8ab9fbabbac61cb8d87c28a4abecfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5295, "upload_time": "2011-12-29T11:40:30", "url": "https://files.pythonhosted.org/packages/90/b1/c4a7ddbfef227b07eeb3cbf17e6efbd0e1e113fb8ea2ea9d08fa0e81d3c8/django-session-attachments-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4d8ab9fbabbac61cb8d87c28a4abecfa", "sha256": "72e010f01dc91a24a01687bc010df4de74c7b4865b2a10d49d20a09836213db5" }, "downloads": -1, "filename": "django-session-attachments-0.2.tar.gz", "has_sig": false, "md5_digest": "4d8ab9fbabbac61cb8d87c28a4abecfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5295, "upload_time": "2011-12-29T11:40:30", "url": "https://files.pythonhosted.org/packages/90/b1/c4a7ddbfef227b07eeb3cbf17e6efbd0e1e113fb8ea2ea9d08fa0e81d3c8/django-session-attachments-0.2.tar.gz" } ] }