{ "info": { "author": "James Pacileo", "author_email": "jamespacileo@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Plugins", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "======\nDjango-SmartAgent\n======\nDescription\n------\n\n:Author:\n James Pacileo\n\n:Version:\n 0.1.0\n\n:Description:\n django-smartagent is an attempt to provide Django developers with a lightning fast and complete browser detection utility.\n\n:Requirements:\n Django 1.2+\n\nInstallation\n------------\n\nInstall from PyPI\n\n::\n\n pip install django-smartagent\n\n #or\n\n easy_install django-smartagent\n\nTo install the app add ``smartagent`` to ``INSTALLED_APPS``\n\n::\n\n INSTALLED_APPS = (\n ...\n 'smartagent',\n ...\n )\n\nAdd the middleware\n\n::\n\n MIDDLEWARE_CLASSES = (\n ...\n 'smartagent.middleware.UserAgentDetectorMiddleware',\n )\n\n**The middleware** is used to attach the browser characteristics to the request object, which will be accessible through **request.browser_info**\n\nUser-Agent data file\n----------------------------\n\nDjango-SmartAgent comes pre-packaged with a data file containing browser info **agents_basic.pkl**. The datafile is built using various resources on the net and generated to be made compatible with the library.\n\nYou can grab the latest datafile from github https://github.com/jamespacileo/django-smartagent/downloads.\n\nOnce you grab the latest data file, place it under your project folder. To inform Django-SmartAgent of the file location you need to edit settings.py by adding:\n\n::\n\n SMART_AGENT_SETTINGS = {\n 'AGENT_DATASET_LOCATION': '/path/to/agent_data_set.pkl',\n }\n\nUtilities for mobile sites\n--------------------------\n\nAs it is popular for sites to have a mobile version, there are a few utility methods within the project.\n\nA **render_to** decorator (based on django-annoying's render_to) renders a page using a desktop or mobile version of a site, depending if the user-agent is a mobile device or not.\n\n::\n\n @render_to(template='desktop_template.html', mobile_template='mobile_template.html')\n def page(request):\n\n articles = Articles.objects.all()[:30]\n return {\n 'articles': articles,\n }\n\nwhich is the equivalent of:\n\n::\n\n def page(request):\n\n articles = Articles.objects.all()[:30]\n if request.browser_info.get('ismobiledevice') and not request.session.get('force_desktop_version'):\n return render_to_response('mobile_tempalte.html', {'articles':articles, },\n context_instance=RequestContext(request))\n return render_to_response('desktop_tempalte.html', {'articles':articles, },\n context_instance=RequestContext(request))\n\n\nTwo utility URLs exist which are used to force/unforce the desktop vesion of the site. This is due to users not always wanting to view the mobile version of the site.\n\n- **smartagent/force_desktop_version/** forces the desktop version for mobile sites\n\n- **smartagent/unforce_desktop_version** unforces the desktop version, forcing mobile devices to view the mobile version\n\n::\n\n urlpatterns = patterns('',\n ...\n (r'^smartagent/', include('smartagent.urls')))\n\nSettings\n--------\n\nA settings variable can be added to your project settings.\n\nThe structure is the following:\n\n::\n\n SMART_AGENT_SETTINGS = {\n 'AGENT_DATASET_LOCATION': 'agents.pk',\n }\n\nUsage\n-----\n\ndjango-smartagent adds the ``browser_info`` dictionary to the ``request`` object containing features associated with the user's browser.\n\n+-----------------------+----------------------------------------------+\n+ Fields exposed within ``browser_data`` +\n+=======================+==============================================+\n+ FIELD NAME + FIELD DESCRIPTION +\n+-----------------------+----------------------------------------------+\n+ cdf + If Channel Definition Format is supported +\n+-----------------------+----------------------------------------------+\n+ activexcontrols + If activexcontrols are supported +\n+-----------------------+----------------------------------------------+\n+ cookies + If cookies are supported +\n+-----------------------+----------------------------------------------+\n+ supportscss + If CSS is supported +\n+-----------------------+----------------------------------------------+\n+ cssversion + Max CSS version supported +\n+-----------------------+----------------------------------------------+\n+ majorver + Major version +\n+-----------------------+----------------------------------------------+\n+ tables + If tables are supported +\n+-----------------------+----------------------------------------------+\n+ iframes + If iframes are supported +\n+-----------------------+----------------------------------------------+\n+ vbscript + If browser supports Visaul Basic scripting +\n+-----------------------+----------------------------------------------+\n+ platform + Host platform of the user's browser +\n+-----------------------+----------------------------------------------+\n+ version + Host OS version +\n+-----------------------+----------------------------------------------+\n+ javaapplets + If browser supports Java Applets +\n+-----------------------+----------------------------------------------+\n+ backgroundsounds + If browser supports background sounds +\n+-----------------------+----------------------------------------------+\n+ win64 + If the host OS is 64bit +\n+-----------------------+----------------------------------------------+\n+ javascript + If browser supports Javascript +\n+-----------------------+----------------------------------------------+\n+ beta + If browser is a beta distribution +\n+-----------------------+----------------------------------------------+\n+ alpha + If browser is an alpha distribution +\n+-----------------------+----------------------------------------------+\n+ minorver + Minor version +\n+-----------------------+----------------------------------------------+\n+ issyndicationreader + If user agent is a syndacation reader +\n+-----------------------+----------------------------------------------+\n+ win32 + If the host OS is 32bit +\n+-----------------------+----------------------------------------------+\n+ ismobiledevice + If host machine is a mobile device +\n+-----------------------+----------------------------------------------+\n+ crawler + If user agent is a web crawler +\n+-----------------------+----------------------------------------------+\n+ win16 + If the host OS is 16bit +\n+-----------------------+----------------------------------------------+\n+ browser + Browser's name +\n+-----------------------+----------------------------------------------+", "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/jamespacileo/django-smartagent/", "keywords": "django apps", "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-smartagent", "package_url": "https://pypi.org/project/django-smartagent/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-smartagent/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jamespacileo/django-smartagent/" }, "release_url": "https://pypi.org/project/django-smartagent/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "django-smartagent is the fastest and most complete user agent parser", "version": "0.1.1" }, "last_serial": 790679, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cdb97e2d7f900a9ac0e0817e6b3cfda6", "sha256": "364ada9c63278eeba01678724be6145ecf275588a78269385e97cc71b4ea1172" }, "downloads": -1, "filename": "django-smartagent-0.1.0.win32.exe", "has_sig": false, "md5_digest": "cdb97e2d7f900a9ac0e0817e6b3cfda6", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 601997, "upload_time": "2011-04-28T04:39:05", "url": "https://files.pythonhosted.org/packages/41/65/17f44f79a088db9845d981d9526e4580689a35a32b08986754dcc5ab2c4d/django-smartagent-0.1.0.win32.exe" }, { "comment_text": "", "digests": { "md5": "59cb652a933609ce32999a00b3f411bc", "sha256": "37a93b5cdcab20067e486eca3d02c2b70a40acb50ffc31d155c39787a4ff83da" }, "downloads": -1, "filename": "django-smartagent-0.1.0.zip", "has_sig": false, "md5_digest": "59cb652a933609ce32999a00b3f411bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206414, "upload_time": "2011-04-28T04:38:56", "url": "https://files.pythonhosted.org/packages/8d/ee/6735eb2a4a7527b4d34406c4ff221ddbf9c06498db29827fa69f3411dfea/django-smartagent-0.1.0.zip" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "578b0acf4fc212c5e5be5c0514af34de", "sha256": "435a79d4d60163430a29f2db19b1738965b9982826d14e39320fe3fad5a094aa" }, "downloads": -1, "filename": "django-smartagent-0.1.1.zip", "has_sig": false, "md5_digest": "578b0acf4fc212c5e5be5c0514af34de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206524, "upload_time": "2011-04-30T02:37:28", "url": "https://files.pythonhosted.org/packages/4b/32/a6337ad2f8e45cf52c47e8c8f270f8bea0f078592236f3e6100b1a684d0e/django-smartagent-0.1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "578b0acf4fc212c5e5be5c0514af34de", "sha256": "435a79d4d60163430a29f2db19b1738965b9982826d14e39320fe3fad5a094aa" }, "downloads": -1, "filename": "django-smartagent-0.1.1.zip", "has_sig": false, "md5_digest": "578b0acf4fc212c5e5be5c0514af34de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206524, "upload_time": "2011-04-30T02:37:28", "url": "https://files.pythonhosted.org/packages/4b/32/a6337ad2f8e45cf52c47e8c8f270f8bea0f078592236f3e6100b1a684d0e/django-smartagent-0.1.1.zip" } ] }