code
stringlengths
1
1.72M
language
stringclasses
1 value
# -*- coding: utf-8 -*- """ flask.session ~~~~~~~~~~~~~ This module used to flask with the session global so we moved it over to flask.sessions :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from warnings import warn warn(DeprecationWarning('please us...
Python
# -*- coding: utf-8 -*- """ flask.sessions ~~~~~~~~~~~~~~ Implements cookie based sessions based on Werkzeug's secure cookie system. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from datetime import datetime from werkzeug.contrib.securecookie import...
Python
# -*- coding: utf-8 -*- """ flask.testing ~~~~~~~~~~~~~ Implements test support helpers. This module is lazily imported and usually not used in production environments. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statem...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.helpers ~~~~~~~~~~~~~~~~~~~~~~~ Various helpers. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import os import flask import unittest from logging import StreamHandler fro...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import re import flask import unittest from datetime import datetime fro...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.ext ~~~~~~~~~~~~~~~~~~~ Tests the extension import thing. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import sys import unittest from flask.testsuite import FlaskTestCase...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.examples ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the examples. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import unittest from flask.testsuite import add_to_path def setup_path(): example_path = os.pat...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.templating ~~~~~~~~~~~~~~~~~~~~~~~~~~ Template functionality :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import flask import unittest from flask.testsuite import FlaskTe...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.subclassing ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test that certain behavior of flask can be customized by subclasses. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import unittest from StringIO import St...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.regression ~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests regressions. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import gc import sys import flask import threading import unittest f...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.testing ~~~~~~~~~~~~~~~~~~~~~~~ Test client and more. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import flask import unittest from flask.testsuite import FlaskTestCase ...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.blueprints ~~~~~~~~~~~~~~~~~~~~~~~~~~ Blueprints (and currently modules) :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import flask import unittest import warnings from fl...
Python
# -*- coding: utf-8 -*- """ flask.testsuite ~~~~~~~~~~~~~~~ Tests Flask itself. The majority of Flask is already tested as part of Werkzeug. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import os import sys im...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.views ~~~~~~~~~~~~~~~~~~~~~ Pluggable views. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import flask.views import unittest from flask.testsuite import FlaskTestCase from werkzeug.http import pars...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.deprecations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests deprecation support. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import flask import unittest from flask.testsuite import...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.config ~~~~~~~~~~~~~~~~~~~~~~ Configuration and instances. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import os import sys import flask import pkgutil import unittest fr...
Python
# -*- coding: utf-8 -*- """ flask.testsuite.signals ~~~~~~~~~~~~~~~~~~~~~~~ Signalling. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import unittest from flask.testsuite import FlaskTestCase class SignalsTestCase(FlaskTestCase): def t...
Python
# -*- coding: utf-8 -*- """ flask.blueprints ~~~~~~~~~~~~~~~~ Blueprints are the recommended way to implement larger or more pluggable applications in Flask 0.7 and later. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from functools import update_wrap...
Python
# -*- coding: utf-8 -*- """ flask.ext ~~~~~~~~~ Redirect imports for extensions. This module basically makes it possible for us to transition from flaskext.foo to flask_foo without having to force all extensions to upgrade at the same time. When a user does ``from flask.ext.foo import bar`` i...
Python
# -*- coding: utf-8 -*- """ flask.logging ~~~~~~~~~~~~~ Implements the logging support for Flask. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from logging import getLogger, StreamHandler, Formatter, getLoggerClas...
Python
# -*- coding: utf-8 -*- """ flask ~~~~~ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ __version__ = '0.9-dev' # utilities we import from Werkzeug an...
Python
# -*- coding: utf-8 -*- """ werkzeug.useragents ~~~~~~~~~~~~~~~~~~~ This module provides a helper to inspect user agent strings. This module is far from complete but should work for most of the currently available browsers. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more deta...
Python
# -*- coding: utf-8 -*- """ werkzeug.datastructures ~~~~~~~~~~~~~~~~~~~~~~~ This module provides mixins and classes with an immutable interface. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import re import codecs import ...
Python
# -*- coding: utf-8 -*- """ werkzeug.http ~~~~~~~~~~~~~ Werkzeug comes with a bunch of utilities that help Werkzeug to deal with HTTP data. Most of the classes and functions provided by this module are used by the wrappers, but they are useful on their own, too, especially if the response and ...
Python
# -*- coding: utf-8 -*- """ werkzeug.utils ~~~~~~~~~~~~~~ This module implements various utilities for WSGI applications. Most of them are used by the request and response wrappers but especially for middleware development it makes sense to use them without the wrappers. :copyright: (c) 2011 ...
Python
# -*- coding: utf-8 -*- """ werkzeug.local ~~~~~~~~~~~~~~ This module implements context-local objects. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from werkzeug.wsgi import ClosingIterator from werkzeug._internal import...
Python
# -*- coding: utf-8 -*- r""" werkzeug.posixemulation ~~~~~~~~~~~~~~~~~~~~~~~ Provides a POSIX emulation for some features that are relevant to web applications. The main purpose is to simplify support for systems such as Windows NT that are not 100% POSIX compatible. Currently this only imple...
Python
# -*- coding: utf-8 -*- """ werkzeug.formparser ~~~~~~~~~~~~~~~~~~~ This module implements the form parsing. It supports url-encoded forms as well as non-nested multipart uploads. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more deta...
Python
# -*- coding: utf-8 -*- """ werkzeug.test ~~~~~~~~~~~~~ This module implements a client to WSGI applications for testing. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import sys import urlparse import mimetypes from time ...
Python
# -*- coding: utf-8 -*- """ werkzeug.urls ~~~~~~~~~~~~~ This module implements various URL related functions. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import urlparse from werkzeug._internal import _decode_unicode fr...
Python
# -*- coding: utf-8 -*- r''' werkzeug.script ~~~~~~~~~~~~~~~ .. admonition:: Deprecated Functionality ``werkzeug.script`` is deprecated without replacement functionality. Python's command line support improved greatly with :mod:`argparse` and a bunch of alternative modules. Most ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Internal tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from datetime import datetime from warnings import filterwarnings, resetwarnings from werkz...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.datastructures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the functionality of the provided Werkzeug datastructures. TODO: - FileMultiDict - convert to proper asserts - Immutable types undertested - Split up dict tests :copy...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.http ~~~~~~~~~~~~~~~~~~~~~~~ HTTP parsing utilities. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from datetime import datetime from werkzeug.testsuite import WerkzeugTestCase from werkzeug...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.debug ~~~~~~~~~~~~~~~~~~~~~~~~ Tests some debug utilities. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest import sys import re from werkzeug.testsuite import WerkzeugTestCase from werkzeug.de...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.utils ~~~~~~~~~~~~~~~~~~~~~~~~ General utilities. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import unittest from datetime import datetime from werkzeug.testsuite i...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.local ~~~~~~~~~~~~~~~~~~~~~~~~ Local and local proxy tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import time import unittest from threading import Thread from werkzeug.testsuite import WerkzeugTestC...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.formparser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the form parsing facilities. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import unittest from StringIO import StringIO ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.test ~~~~~~~~~~~~~~~~~~~~~~~ Tests the testing tools. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import sys import unittest from cStringIO import StringIO, OutputTyp...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.urls ~~~~~~~~~~~~~~~~~~~~~~~ URL helper tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from StringIO import StringIO from werkzeug.testsuite import WerkzeugTestCase from werkzeug.data...
Python
#!/usr/bin/env python """ Hacky helper application to collect form data. """ from werkzeug.serving import run_simple from werkzeug.wrappers import Request, Response def copy_stream(request): from os import mkdir from time import time folder = 'request-%d' % time() mkdir(folder) environ = request.e...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The tests for the exception classes. TODO: - This is undertested. HTML is never checked :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest fro...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.routing ~~~~~~~~~~~~~~~~~~~~~~~~~~ Routing tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from werkzeug.testsuite import WerkzeugTestCase from werkzeug import routing as r from werkzeu...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.fixers ~~~~~~~~~~~~~~~~~~~~~~~~~ Server / Browser fixers. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from werkzeug.testsuite import WerkzeugTestCase from werkzeug.datastructures import Res...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.cache ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the cache system :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import time import unittest import tempfile import shutil from werkzeug.testsuite import Werkzeug...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.sessions ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Added tests for the sessions. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest import shutil from werkzeug.testsuite import WerkzeugTestCase from werkzeug.c...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.iterio ~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the iterio object. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from werkzeug.testsuite import WerkzeugTestCase from werkzeug.contrib.iterio import Ite...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.securecookie ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the secure cookie. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from werkzeug.testsuite import WerkzeugTestCase from werkzeug.utils import...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.contrib ~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the contrib modules. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest from werkzeug.testsuite import iter_suites def suite(): suite = unittest.TestS...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.contrib.wrappers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Added tests for the sessions. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import unittest from werkzeug.testsuit...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.serving ~~~~~~~~~~~~~~~~~~~~~~~~~~ Added serving tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import sys import time import urllib import unittest from functools import update_wrapper from StringIO im...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite ~~~~~~~~~~~~~~~~~~ Contains all test Werkzeug tests. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import unittest from werkzeug.utils import import_string, find_module...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.wsgi ~~~~~~~~~~~~~~~~~~~~~~~ Tests the WSGI utilities. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import unittest from os import path from cStringIO import StringIO ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.wrappers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests for the response and request objects. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest import pickle from StringIO import StringIO from datetime import ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.compat ~~~~~~~~~~~~~~~~~~~~~~~~~ Ensure that old stuff does not break on update. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import unittest import warnings from werkzeug.testsuite import WerkzeugTestCase ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testsuite.security ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests the security helpers. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import unittest from werkzeug.testsuite import WerkzeugTestCase from werkzeug.securit...
Python
# -*- coding: utf-8 -*- """ werkzeug.exceptions ~~~~~~~~~~~~~~~~~~~ This module implements a number of Python exceptions you can raise from within your views to trigger a standard non-200 response. Usage Example ------------- :: from werkzeug.wrappers import BaseRequest ...
Python
# -*- coding: utf-8 -*- """ werkzeug.testapp ~~~~~~~~~~~~~~~~ Provide a small test application that can be used to test a WSGI server and check it for WSGI compliance. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ impo...
Python
# -*- coding: utf-8 -*- """ werkzeug._internal ~~~~~~~~~~~~~~~~~~ This module provides internally used helpers and constants. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import inspect from weakref import WeakKeyDictiona...
Python
# -*- coding: utf-8 -*- """ werkzeug.routing ~~~~~~~~~~~~~~~~ When it comes to combining multiple controller or view functions (however you want to call them) you need a dispatcher. A simple way would be applying regular expression tests on the ``PATH_INFO`` and calling registered callback fun...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.testtools ~~~~~~~~~~~~~~~~~~~~~~~~~~ This module implements extended wrappers for simplified testing. `TestResponse` A response wrapper which adds various cached attributes for simplified assertions on various content types. :copyright:...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.fixers ~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 0.5 This module includes various helpers that fix bugs in web servers. They may be necessary for some versions of a buggy web server but not others. We try to stay updated with the status of the bug...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.atom ~~~~~~~~~~~~~~~~~~~~~ This module provides a class called :class:`AtomFeed` which can be used to generate feeds in the Atom syndication format (see :rfc:`4287`). Example:: def atom_feed(request): feed = AtomFeed("My Blog", feed...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.cache ~~~~~~~~~~~~~~~~~~~~~~ The main problem with dynamic Web sites is, well, they're dynamic. Each time a user requests a page, the webserver executes a lot of code, queries the database, renders templates until the visitor gets the page he sees. ...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.jsrouting ~~~~~~~~~~~~~~~~~~~~~~~~~~ Addon module that allows to create a JavaScript function from a map that generates rules. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ ...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.lint ~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 0.5 This module provides a middleware that performs sanity checks of the WSGI application. It checks that :pep:`333` is properly implemented and warns on some common HTTP errors such as non-empty respons...
Python
# -*- coding: utf-8 -*- r""" werkzeug.contrib.sessions ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains some helper classes that help one to add session support to a python WSGI application. For full client-side session storage see :mod:`~werkzeug.contrib.securecookie` which implements a secure,...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.profiler ~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides a simple WSGI profiler middleware for finding bottlenecks in web application. It uses the :mod:`profile` or :mod:`cProfile` module to do the profiling and writes the stats to the stream provide...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.kickstart ~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides some simple shortcuts to make using Werkzeug simpler for small scripts. These improvements include predefined `Request` and `Response` objects as well as a predefined `Application` object whi...
Python
# -*- coding: utf-8 -*- r""" werkzeug.contrib.iterio ~~~~~~~~~~~~~~~~~~~~~~~ This module implements a :class:`IterIO` that converts an iterator into a stream object and the other way round. Converting streams into iterators requires the `greenlet`_ module. To convert an iterator into a stream...
Python
# -*- coding: utf-8 -*- r""" werkzeug.contrib.securecookie ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module implements a cookie that is not alterable from the client because it adds a checksum the server checks for. You can use it as session replacement if all you have is a user id or something to mark ...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib ~~~~~~~~~~~~~~~~ Contains user-submitted code that other users may find useful, but which is not part of the Werkzeug core. Anyone can write code for inclusion in the `contrib` package. All modules in this package are distributed as an add-on libra...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.limiter ~~~~~~~~~~~~~~~~~~~~~~~~ A middleware that limits incoming data. This works around problems with Trac_ or Django_ because those directly stream into the memory. .. _Trac: http://trac.edgewall.org/ .. _Django: http://www.djangoproject.com/ ...
Python
# -*- coding: utf-8 -*- """ werkzeug.contrib.wrappers ~~~~~~~~~~~~~~~~~~~~~~~~~ Extra wrappers or mixins contributed by the community. These wrappers can be mixed in into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase fr...
Python
# -*- coding: utf-8 -*- """ werkzeug.serving ~~~~~~~~~~~~~~~~ There are many ways to serve a WSGI application. While you're developing it you usually don't want a full blown webserver like Apache but a simple standalone one. From Python 2.5 onwards there is the `wsgiref`_ server in the standa...
Python
# -*- coding: utf-8 -*- """ werkzeug ~~~~~~~~ Werkzeug is the Swiss Army knife of Python web development. It provides useful classes and functions for any WSGI application to make the life of a python web developer much easier. All of the provided classes are independent from each other so yo...
Python
# -*- coding: utf-8 -*- """ werkzeug.wsgi ~~~~~~~~~~~~~ This module implements WSGI related helpers. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import re import os import urllib import urlparse import posixpath import m...
Python
# -*- coding: utf-8 -*- """ werkzeug.wrappers ~~~~~~~~~~~~~~~~~ The wrappers are simple request and response objects which you can subclass to do whatever you want them to do. The request object contains the information transmitted by the client (webbrowser) and the response object contains al...
Python
# -*- coding: utf-8 -*- """ werkzeug.security ~~~~~~~~~~~~~~~~~ Security related helpers such as secure password hashing tools. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import os import hmac import posixpath from iter...
Python
# -*- coding: utf-8 -*- r""" werkzeug.templates ~~~~~~~~~~~~~~~~~~ A minimal template engine. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD License. """ import sys import re import __builtin__ as builtins from compiler import ast, parse from compiler.pycode...
Python
# -*- coding: utf-8 -*- """ flask.views ~~~~~~~~~~~ This module provides class-based views inspired by the ones in Django. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from .globals import request http_method_funcs = frozenset(['get', 'post', 'head', '...
Python
# -*- coding: utf-8 -*- """ flask.wrappers ~~~~~~~~~~~~~~ Implements the WSGI wrappers (request and response). :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase from werkzeug.exce...
Python
# -*- coding: utf-8 -*- """ flask.app ~~~~~~~~~ This module implements the central WSGI application object. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import os import sys from threading import Lock from datetime...
Python
# -*- coding: utf-8 -*- """ flask.debughelpers ~~~~~~~~~~~~~~~~~~ Various helpers to make the development experience better. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ class DebugFilesKeyError(KeyError, AssertionError): """Raised from request.fil...
Python
# -*- coding: utf-8 -*- """ flask.globals ~~~~~~~~~~~~~ Defines all the global objects that are proxies to the current active context. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from functools import partial from werkzeug.local import LocalStack, ...
Python
# -*- coding: utf-8 -*- """ flask.config ~~~~~~~~~~~~ Implements the configuration related objects. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import imp import os import errno from werkzeug.utils import import_...
Python
# -*- coding: utf-8 -*- """ flask.signals ~~~~~~~~~~~~~ Implements signals based on blinker if available, otherwise falls silently back to a noop :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ signals_available = False try: from blinker import Name...
Python
from flask import Flask import settings app = Flask('accounting') app.config.from_object('accounting.settings') import views
Python
from accounting import app from models import Post from flask import render_template @app.route('/posts') def list_posts(): posts = Post.all() return render_template('list_posts.html', post=posts)
Python
from google.appengine.ext import db class Reserva(db.Model): persona = db.IntegerProperty(default = 0) username = db.StringProperty() dttm = db.DateTimeProperty() dttm_end = db.DateTimeProperty() waiter_name = db.StringProperty() no_of_tables = db.IntegerProperty() tables = db.StringProperty...
Python
from google.appengine.ext import db class Order(db.Model): Orden =
Python
from google.appengine.ext import db class Cashier(db.Model): sum_type = db.StringProperty() sum_type_ext = db.StringProperty() sum_price = db.IntegerProperty() tip_type = db.StringProperty() tip_type_ext = db.StringProperty() propina = db.IntegerProperty() tip_price = db.IntegerProperty() g...
Python
import decimal from wtforms import fields, widgets class ReferencePropertyField(fields.SelectFieldBase): """ A field for ``db.ReferenceProperty``. The list items are rendered in a select. :param reference_class: A db.Model class which will be used to generate the default query to make...
Python
""" Form generation utilities for App Engine's ``db.Model`` class. The goal of ``model_form()`` is to provide a clean, explicit and predictable way to create forms based on ``db.Model`` classes. No malabarism or black magic should be necessary to generate a form for models, and to add custom non-model related fields: ...
Python
""" Tools for generating forms based on SQLAlchemy models. """ import inspect from wtforms import fields as f from wtforms import validators from wtforms.form import Form __all__ = ( 'model_fields', 'model_form', ) def converts(*args): def _inner(func): func._converter_for = frozenset(args) ...
Python
""" Useful form fields for use with SQLAlchemy ORM. """ import operator from wtforms import widgets from wtforms.fields import SelectFieldBase from wtforms.validators import ValidationError try: from sqlalchemy.orm.util import identity_key has_identity_key = True except ImportError: has_identity_key = Fal...
Python
""" A DateTimeField and DateField that use the `dateutil` package for parsing. """ from dateutil import parser from wtforms.fields import Field from wtforms.validators import ValidationError from wtforms.widgets import TextInput __all__ = ( 'DateTimeField', 'DateField', ) class DateTimeField(Field): """ ...
Python
""" Tools for generating forms based on Django models. """ from wtforms import fields as f from wtforms import Form from wtforms import validators from wtforms.ext.django.fields import ModelSelectField __all__ = ( 'model_fields', 'model_form', ) class ModelConverterBase(object): def __init__(self, converter...
Python
""" Template tags for easy WTForms access in Django templates. """ import re from django import template from django.conf import settings from django.template import Variable register = template.Library() class FormFieldNode(template.Node): def __init__(self, field_var, html_attrs): self.field_var = fi...
Python
""" Useful form fields for use with the Django ORM. """ import operator import warnings from wtforms import widgets from wtforms.fields import SelectFieldBase from wtforms.validators import ValidationError __all__ = ( 'ModelSelectField', 'QuerySetSelectField', ) class QuerySetSelectField(SelectFieldBase): ...
Python