Metadata-Version: 1.1
Name: Flask-Mime
Version: 0.1.0
Summary: Provides MIME type based request dispatching mechanism.
Home-page: https://github.com/lanius/flask-mime/
Author: lanius
Author-email: lanius@nirvake.org
License: Copyright (c) 2014 by lanius.

Some rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following
  disclaimer in the documentation and/or other materials provided
  with the distribution.

* The names of the contributors may not be used to endorse or
  promote products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description: 
        Flask-Mime
        ==========
        
        Flask-Mime is Flask extension that enables applications to dispatch requests based on Accept header of it.
        
        
        Install
        -------
        
        Install the extension with the following command:
        
        .. code-block:: bash
        
            $ pip install Flask-Mime
        
        
        Usage
        -----
        
        Create a Mime object and define routes with MIME types:
        
        .. code-block:: python
        
            from flask import Flask, render_template, jsonify
            from flask_mime import Mime
        
            app = Flask(__name__)
            mimetype = Mime(app)
        
            @mimetype('text/html')
            @app.route('/')
            def index_html():
                return render_template('index.html')
        
            @mimetype('application/json')
            @app.route('/')
            def index_json():
                return jsonify(data={'content': 'index'})
        
        
        Each requests are dispatched depending on the value of Accept header, even though they have same request path:
        
        .. code-block:: python
        
            client = app.test_client()
            client.get('/', headers={'Accept': 'text/html'})  # returns html
            client.get('/', headers={'Accept': 'application/json'})  # returns json
        
        
        Note
        ----
        
        Note that MIME type based request dispatching mechanism may have negative influence for some applications, for example, which has a cache system.
        
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
