Metadata-Version: 1.0
Name: django-pybrowscap
Version: 0.9
Summary: django-pybrowscap is django middleware with support for pybrowscap
Home-page: http://www.codescale.net/en/community#django-pybrowscap
Author: Vladimír Gorej
Author-email: gorej@codescale.net
License: BSD
Download-URL: http://github.com/char0n/django-pybrowscap/tarball/master
Description: django-pybrowscap
        =================
        
        
        django-pybrowscap is django middleware with support for pybrowscap.
        It decorates request with browser attribute, browser being instance of pybrowscap.Browser class.
        
        Requirements
        ------------
        
        - python 2.7+
        - django
        - pybrowscap
        - browscap csv file (http://browsers.garykeith.com/downloads.asp)
        
        
        Installation
        ------------
        
        Install via pipy or copy this module into your project or into your PYTHON_PATH.
        Download latest version of browscap.csv file from http://browsers.garykeith.com/downloads.asp.
        
        
        **Put django_pybrowscap into INSTALLED_APPS in your projects settings.py file**
        
        ::
        
         INSTALLED_APPS = (
             'localeurl',
             'django.contrib.auth',
             'django.contrib.contenttypes',
             'django.contrib.sessions',
             'django.contrib.sites',
             'django.contrib.admin',
             'django.contrib.sitemaps',
             'web',
             'debug_toolbar',
             'rosetta',
             'south',
             'django_pybrowscap'
         )
        
        
        **Put django_pybrowscap.middleware.PybrowscapMiddleware into MIDDLEWARE_CLASSES in your projects settings.py file**
        
        ::
        
         MIDDLEWARE_CLASSES = (
             'web.middleware.LocaleMiddleware',
             'django.middleware.common.CommonMiddleware',
             'django.contrib.sessions.middleware.SessionMiddleware',
             'django_pybrowscap.middleware.PybrowscapMiddleware',
             ....
         )
        
        
        Configuration
        -------------
        
        **django settings.py constants**
        
        ::
        
         # This setting will effectively turn the middleware off, to speed up requests/response while developing
         PYBROWSCAP_INITIALIZE = True # Default is `not settings.DEBUG`.
        
         # Path where browscap file is located on filesystem
         PYBROWSCAP_FILE_PATH = MEDIA_ROOT+os.sep+'browscap.csv' # Default is '' (empty string)
        
         # Whether to perform automatic updates of browscap file
         PYBROWSCAP_UPDATE = False # Default is False
        
         # Interval of automatic browscap file updates
         PYBROWSCAP_UPDATE_INTERVAL = 604800 # Default one week in seconds
        
         # Tuple or regex expressions of path that are to be ignored by middleware
         PYBROWSCAP_IGNORE_PATHS = (
             re.compile(r'^/sitemap.xml$'),
             re.compile(r'^/robots.txt$'),
             re.compile(r'^/favicon.ico$'),
             re.compile(r'^/media/')
         ) # Default empty tupple
        
        
        Example
        -------
        
        ::
        
         def standard_view(request):
             if request.browser is not None and request.browser.is_crawler():
                 # do something
             else:
                 # do something else
        
        
        
        Tests
        -----
        
        **Tested on evnironment**
        
        - Xubuntu Linux 11.10 oneiric 64-bit
        - python 2.7.2+
        - python unitest
        - browscap.07_10_2011.csv from Fri, 07 Oct 2011 06:46:46 -0000
        
        **Running tests**
        
        To run the test run command: ::
        
         $ python manage.py test django_pybrowscap
        
        
        
        Author
        ------
        
        | char0n (Vladimir Gorej, CodeScale s.r.o.)
        | email: gorej@codescale.net
        | web: http://www.codescale.net
        
        
        References
        ----------
        
        - http://github.com/char0n/django-pybrowscap
        - http://browsers.garykeith.com/
        - http://php.net/get_browser
        - http://www.codescale.net/en/community#django-pybrowscap
Keywords: browser browscap detection user agent django
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Utilities
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
