This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Flask-UUID is a simple Flask extension that registers a UUID converter for urls on a Flask application. It uses the standard library’s uuid module to convert UUIDs to and from strings.

This extension allows you to easily route and generate urls containing UUID, e.g. /page/fe4a3e33-cb4b-42ac-a29b-a8160a85af7e.

Installation

Installation is trivial:

$ pip install Flask-UUID

Usage

Flask-UUID is a well-behaved Flask extension, so you can either initialise it directly upon instantiation:

from flask import Flask
from flask.ext.uuid import FlaskUUID

app = Flask(__name__)
FlaskUUID(app)

Or initialise it like this:

from flask import Flask
from flask.ext.uuid import FlaskUUID

app = Flask(__main__)

flask_uuid = FlaskUUID()
flask_uuid.init_app(app)

Now you can use it in your routes like any other converter:

@app.route('/<uuid:id>')
def mypage(id):
    return id  # 'id' is a uuid.UUID instance

You can also use UUID instances to generate urls:

random_uuid = uuid.uuid4()
url = app.url_for('mypage', id=random_uuid)

Note that, by default, the converter only accepts and generates lowercase hexadecimal UUIDs with dashes at the proper places, in order to keep urls unique. If you want to accept any UUID string accepted by the uuid.UUID() constructor, simply set the strict flag to False:

@app.route('/<uuid(strict=False):id>'>
def mypage(id):
    return id

License

This software is BSD licensed; see LICENSE.rst for more information.

Release History

Release History

0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Flask-UUID-0.2.tar.gz (2.0 kB) Copy SHA256 Checksum SHA256 Source Jun 13, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting