Skip to content
Myr

Heavily improved documentation

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 4e1b3e1 · Browse files · 10 files+486 added−44 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+486 added−44 removed

  • other:+486 added−44 removed

10 files+486 added−44 removed

modified:docs/_templates/sidebarintro.html+5 added
modified:docs/_themes/flasky/static/flasky.css_t+74 added-20 removed
14 unmodified lines
15 16body {17 font-family: 'Georgia', serif;18 font-size: 100%;19 background-color: #111;19 background-color: #555;20 color: #555;21 margin: 0;22 padding: 0;23}
22 unmodified lines
46 font-size: 0.9em;47}48 49div.footer {50 color: #555;51 width: 100%;52 padding: 13px 0;53 text-align: center;54 font-size: 75%;50 color: #ccc;51 padding: 10px;52 font-size: 0.8em;53}54 55div.footer a {58 color: #444;56 color: white;57 text-decoration: underline;58}59 60div.related {
74 unmodified lines
135 136/* -- body styles ----------------------------------------------------------- */137 138a {141 color: #003B55;139 color: #004B6B;140 text-decoration: none;141}142 143a:hover {
12 unmodified lines
156 font-weight: normal;157 color: #212224;158 margin: 30px 0px 10px 0px;159 padding: 8px 0 5px 10px;162 text-shadow: 0px 1px 0 white160 text-shadow: 0px 1px 0 white;161}162 163div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; }164div.body h2 { font-size: 150%; background-color: #ddd; }
2 unmodified lines
167div.body h5 { font-size: 100%; background-color: #eee; }168div.body h6 { font-size: 100%; background-color: #eee; }169 170a.headerlink {173 color: #c60f0f;171 color: white;172 padding: 0 4px;173 text-decoration: none;174}175 176a.headerlink:hover {179 background-color: #c60f0f;180 color: white;177 color: #444;178 background: #eaeaea;179}180 181div.body p, div.body dd, div.body li {182 line-height: 1.5em;
32 unmodified lines
215 216p.admonition-title:after {217 content: ":";218}219220pre, tt {221 font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;222 font-size: 0.9em;223}224225tt.descname, tt.descclassname {226 font-size: 0.95em;227 -webkit-box-shadow: none;228 -moz-box-shadow: none;229}230231tt.descname {232 padding-right: 0.08em;233}234235table.docutils {236 border: 1px solid #888;237 -webkit-box-shadow: 2px 2px 1px #d8d8d8;238 -moz-box-shadow: 2px 2px 1px #d8d8d8;239}240241table.docutils td, table.docutils th {242 border: 1px solid #888;243 padding: 0.25em 0.7em;244}245246table.field-list {247 border: none;248 -webkit-box-shadow: none;249 -moz-box-shadow: none;250}251252table.field-list th {253 padding: 0 0.8em 0 0;254}255256table.field-list td {257 padding: 0;258}259 260pre {261 background: #FDFDFD;262 padding: 10px;263 color: #222;225 line-height: 1.2em;226 border: 1px solid #C6C9CB;227 font-size: 1.1em;228 margin: 1.5em 0 1.5em 0;229 -webkit-box-shadow: 1px 1px 1px #d8d8d8;230 -moz-box-shadow: 1px 1px 1px #d8d8d8;264 line-height: 1.3em;265 border: 1px solid #f9f9f9;266 margin: 1.5em 3px 1.5em 0;267 -webkit-box-shadow: 2px 2px 1px #d8d8d8;268 -moz-box-shadow: 2px 2px 1px #d8d8d8;269}270 271tt {272 background-color: #ecf0f3;273 color: #222;274 /* padding: 1px 2px; */237 font-size: 1.1em;238 font-family: monospace;275 -webkit-box-shadow: 1px 1px 1px #d8d8d8;276 -moz-box-shadow: 1px 1px 1px #d8d8d8;277}278279tt.xref, a tt {280 background-color: #FBFBFB;281}282283a:hover tt {284 background: #EEE;285}286287div.document + div.related {288 background: #aaa;289}290291div.document + div.related a {292 color: white;293}
modified:docs/api.rst+7 added-1 removed
161 unmodified lines
162----------------------------163164.. autofunction:: url_for165166.. autofunction:: abort166.. function:: abort(code)167168 Raises an :exc:`~werkzeug.exception.HTTPException` for the given169 status code. For example to abort request handling with a page not170 found exception, you would call ``abort(404)``.171172 :param code: the HTTP error code.173174.. autofunction:: redirect175176.. autofunction:: escape177
16 unmodified lines
added:docs/deploying.rst+266 added
1Deployment Options2==================34Depending on what you have available there are multiple ways to run Flask5applications. A very common method is to use the builtin server during6development and maybe behind a proxy for simple applications, but there7are more options available.89If you have a different WSGI server look up the server documentation about10how to use a WSGI app with it. Just remember that your application object11is the actual WSGI application.121314FastCGI15-------1617A very popular deployment setup on servers like `lighttpd`_ and `nginx`_18is FastCGI. To use your WSGI application with any of them you will need19a FastCGI server first.2021The most popular one is `flup`_ which we will use for this guide. Make22sure to have it installed.2324Creating a `.fcgi` file25```````````````````````2627First you need to create the FastCGI server file. Let's call it28`yourapplication.fcgi`::2930 #!/usr/bin/python31 from flup.server.fcgi import WSGIServer32 from yourapplication import app3334 WSGIServer(app).run()3536This is enough for Apache to work, however lighttpd and nginx need a37socket to communicate with the FastCGI server. For that to work you38need to pass the path to the socket to the39:class:`~flup.server.fcgi.WSGIServer`::4041 WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()4243The path has to be the exact same path you define in the server44config.4546Save the `yourapplication.fcgi` file somewhere you will find it again.47It makes sense to have that in `/var/www/yourapplication` or something48similar.4950Make sure to set the executable bit on that file so that the servers51can execute it::5253 # chmod +x /var/www/yourapplication/yourapplication.fcgi5455Configuring lighttpd56````````````````````5758A basic FastCGI configuration for lighttpd looks like that::5960 fastcgi.server = ("/yourapplication" =>61 "yourapplication" => (62 "socket" => "/tmp/yourapplication-fcgi.sock",63 "bin-path" => "/var/www/yourapplication/yourapplication.fcgi",64 "check-local" => "disable"65 )66 )6768This configuration binds the application to `/yourapplication`. If you69want the application to work in the URL root you have to work around a70lighttpd bug with the `~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.7172Make sure to apply it only if you are mounting the application the URL73root.7475Configuring nginx76`````````````````7778Installing FastCGI applications on nginx is a bit tricky because by default79some FastCGI parameters are not properly forwarded.8081A basic FastCGI configuration for nginx looks like this::8283 location /yourapplication/ {84 include fastcgi_params;85 if ($uri ~ ^/yourapplication/(.*)?) {86 set $path_url $1;87 }88 fastcgi_param PATH_INFO $path_url;89 fastcgi_param SCRIPT_NAME /yourapplication;90 fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;91 }9293This configuration binds the application to `/yourapplication`. If you want94to have it in the URL root it's a bit easier because you don't have to figure95out how to calculate `PATH_INFO` and `SCRIPT_NAME`::9697 location /yourapplication/ {98 include fastcgi_params;99 fastcgi_param PATH_INFO $fastcgi_script_name;100 fastcgi_param SCRIPT_NAME "";101 fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;102 }103104Since Nginx doesn't load FastCGI apps, you have to do it by yourself. You105can either write an `init.d` script for that or execute it inside a screen106session::107108 $ screen109 $ /var/www/yourapplication/yourapplication.fcgi110111Debugging112`````````113114FastCGI deployments tend to be hard to debug on most webservers. Very often the115only thing the server log tells you is something along the lines of "premature116end of headers". In order to debug the application the only thing that can117really give you ideas why it breaks is switching to the correct user and118executing the application by hand.119120This example assumes your application is called `application.fcgi` and that your121webserver user is `www-data`::122123 $ su www-data124 $ cd /var/www/yourapplication125 $ python application.fcgi126 Traceback (most recent call last):127 File "yourapplication.fcg", line 4, in <module>128 ImportError: No module named yourapplication129130In this case the error seems to be "yourapplication" not being on the python131path. Common problems are:132133- relative paths being used. Don't rely on the current working directory134- the code depending on environment variables that are not set by the135 web server.136- different python interpreters being used.137138.. _lighttpd: http://www.lighttpd.net/139.. _nginx: http://nginx.net/140.. _flup: http://trac.saddi.com/flup141142143mod_wsgi (Apache)144-----------------145146If you are using the `Apache`_ webserver you should consider using `mod_wsgi`_.147148.. _Apache: http://httpd.apache.org/149150Installing `mod_wsgi`151`````````````````````152153If you don't have `mod_wsgi` installed yet you have to either install it using154a package manager or compile it yourself.155156The mod_wsgi `installation instructions`_ cover installation instructions for157source installations on UNIX systems.158159If you are using ubuntu / debian you can apt-get it and activate it as follows::160161 # apt-get install libapache2-mod-wsgi162163On FreeBSD install `mod_wsgi` by compiling the `www/mod_wsgi` port or by using164pkg_add::165166 # pkg_add -r mod_wsgi167168If you are using pkgsrc you can install `mod_wsgi` by compiling the169`www/ap2-wsgi` package.170171If you encounter segfaulting child processes after the first apache reload you172can safely ignore them. Just restart the server.173174Creating a `.wsgi` file175```````````````````````176177To run your application you need a `yourapplication.wsgi` file. This file178contains the code `mod_wsgi` is executing on startup to get the application179object. The object called `application` in that file is then used as180application.181182For most applications the following file should be sufficient::183184 from yourapplication import app as application185186If you don't have a factory function for application creation but a singleton187instance you can directly import that one as `application`.188189Store that file somewhere where you will find it again (eg:190`/var/www/yourapplication`) and make sure that `yourapplication` and all191the libraries that are in use are on the python load path. If you don't192want to install it system wide consider using a `virtual python`_ instance.193194Configuring Apache195``````````````````196197The last thing you have to do is to create an Apache configuration file for198your application. In this example we are telling `mod_wsgi` to execute the199application under a different user for security reasons:200201.. sourcecode:: apache202203 <VirtualHost *>204 ServerName example.com205206 WSGIDaemonProcess yourapplication user=user1 group=group1 processes=1 threads=5207 WSGIScriptAlias / /var/www/yourapplication/yourapplication.wsgi208209 <Directory /var/www/yourapplication>210 WSGIProcessGroup yourapplication211 WSGIApplicationGroup %{GLOBAL}212 Order deny,allow213 Allow from all214 </Directory>215 </VirtualHost>216217For more information consult the `mod_wsgi wiki`_.218219.. _mod_wsgi: http://code.google.com/p/modwsgi/220.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide221.. _virtual python: http://pypi.python.org/pypi/virtualenv222.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/223224225CGI226---227228If all other deployment methods do not work, CGI will work for sure. CGI229is supported by all major browsers but usually has a less-than-optimal230performance.231232This is also the way you can use a Flask application on Google's233`AppEngine`_, there however the execution does happen in a CGI-like234environment. The application's performance is unaffected because of that.235236.. _AppEngine: http://code.google.com/appengine/237238Creating a `.cgi` file239``````````````````````240241First you need to create the CGI application file. Let's call it242`yourapplication.cgi`::243244 #!/usr/bin/python245 from wsgiref.handlers import CGIHandler246 from yourapplication import app247248 CGIHandler().run(app)249250If you're running Python 2.4 you will need the :mod:`wsgiref` package. Python2512.5 and higher ship this as part of the standard library.252253Server Setup254````````````255256Usually there are two ways to configure the server. Either just copy the257`.cgi` into a `cgi-bin` (and use `mod_rerwite` or something similar to258rewrite the URL) or let the server point to the file directly.259260In Apache for example you can put a like like this into the config:261262.. sourcecode:: apache263264 ScriptName /app /path/to/the/application.cgi265266For more information consult the documentation of your webserver.
modified:docs/flaskext.py+5 added-15 removed
14 unmodified lines
15 Error: "#a40000 border:#ef2929", # class: 'err'16 Other: "#000000", # class 'x'1718 Comment: "italic #8f5902", # class: 'c'19 Comment.Multiline: "italic #8f5902", # class: 'cm'20 Comment.Preproc: "italic #8f5902", # class: 'cp'21 Comment.Single: "italic #8f5902", # class: 'c1'22 Comment.Special: "italic #8f5902", # class: 'cs'19 Comment.Preproc: "noitalic", # class: 'cp'2021 Keyword: "bold #004461", # class: 'k'22 Keyword.Constant: "bold #004461", # class: 'kc'23 Keyword.Declaration: "bold #004461", # class: 'kd'
15 unmodified lines
39 Name.Builtin: "#004461", # class: 'nb'40 Name.Builtin.Pseudo: "#3465a4", # class: 'bp'41 Name.Class: "#000000", # class: 'nc' - to be revised42 Name.Constant: "#000000", # class: 'no' - to be revised46 Name.Decorator: "#999", # class: 'nd' - to be revised43 Name.Decorator: "#888", # class: 'nd' - to be revised44 Name.Entity: "#ce5c00", # class: 'ni'45 Name.Exception: "bold #cc0000", # class: 'ne'46 Name.Function: "#000000", # class: 'nf'47 Name.Property: "#000000", # class: 'py'
5 unmodified lines
53 Name.Variable.Class: "#000000", # class: 'vc' - to be revised54 Name.Variable.Global: "#000000", # class: 'vg' - to be revised55 Name.Variable.Instance: "#000000", # class: 'vi' - to be revised5660 # since the tango light blue does not show up well in text, we choose61 # a pure blue instead.62 Number: "bold #0000cf", # class: 'm'57 Number: "#990000", # class: 'm'63 Number.Float: "bold #0000cf", # class: 'mf'64 Number.Hex: "bold #0000cf", # class: 'mh'65 Number.Integer: "bold #0000cf", # class: 'mi'66 Number.Integer.Long: "bold #0000cf", # class: 'il'67 Number.Oct: "bold #0000cf", # class: 'mo'5859 Literal: "#000000", # class: 'l'60 Literal.Date: "#000000", # class: 'ld'61
15 unmodified lines
77 Generic.Emph: "italic #000000", # class: 'ge'78 Generic.Error: "#ef2929", # class: 'gr'79 Generic.Heading: "bold #000080", # class: 'gh'80 Generic.Inserted: "#00A000", # class: 'gi'91 Generic.Output: "italic #000000", # class: 'go'92 Generic.Prompt: "#8f5902", # class: 'gp'81 Generic.Output: "#888", # class: 'go'82 Generic.Prompt: "#745334", # class: 'gp'83 Generic.Strong: "bold #000000", # class: 'gs'84 Generic.Subheading: "bold #800080", # class: 'gu'85 Generic.Traceback: "bold #a40000", # class: 'gt'86 }
modified:docs/foreword.rst+9 added
34 unmodified lines
35something the framework just cannot do for you without modification.36If you are ever in that situation, check out the :ref:`becomingbig`37chapter.3839A Framework and An Example40--------------------------4142Flask is not only a microframework, it is also an example. Based on43Flask, there will be a series of blog posts that explain how to create a44framework. Flask itself is just one way to implement a framework on top45of existing libraries. Unlike many other microframeworks Flask does not46try to implement anything on its own, it reuses existing code.4748Target Audience49---------------5051Is Flask for you? Is your application small-ish (less than 4000 lines of
15 unmodified lines
modified:docs/index.rst+1 added
18 unmodified lines
19 installation20 quickstart21 patterns22 api23 deploying24 becomingbig
modified:docs/installation.rst+39 added-4 removed
39 unmodified lines
4041If you are on OS X or Linux chances are that one of the following two42commands will for for you::4344 sudo easy_install virtualenv44 $ sudo easy_install virtualenv4546or even better::4748 sudo pip install virtualenv48 $ sudo pip install virtualenv4950Changes are you have virtualenv installed on your system then. Maybe it's51even in your package manager (on ubuntu try ``sudo apt-get install52python-virtualenv``).5354On windows, just installed virtualenv from the `Python Package Index55<http://pypi.python.org/pypi/virtualenv>`_.54If you are on Windows and missing the `easy_install` command you have to55install it first. Check the :ref:`windows-easy-install` section for more56information about how to do that.5758So now that you have virtualenv running just fire up a shell and create59your own environment. I usually create a folder and a `env` folder60within::
40 unmodified lines
101102Now I really don't recommend this way on using Flask, but you can do that103of course as well. Download the `dip` zipfile from the website and unzip104it next to your application.105106.. _windows-easy-install:107108`easy_install` on Windows109-------------------------110111On Windows installation of `easy_install` is a little bit tricker because112on Windows slightly different rules apply, but it's not a biggy. The113easiest way to accomplish that is downloading the `ez_setup.py`_ file and114running it. (Double clicking should do the trick)115116Once you have done that it's important to add the `easy_install` command117and other Python scripts to the path. To do that you have to add the118Python installation's Script folder to the `PATH` variable.119120To do that, click right on your "Computer" desktop icon and click121"Properties". On Windows Vista and Windows 7 then click on "Advanced System122settings", on Windows XP click on the "Advanced" tab instead. Then click123on the "Environment variables" button and double click on the "Path"124variable in the "System variables" section.125126There append the path of your Python interpreter's Script folder to the127end of the last (make sure you delimit it from existing values with a128semicolon). Assuming you are using Python 2.6 on the default path, add129the following value::130131 ;C:\Python26\Scripts132133Then you are done. To check if it worked, open the cmd and execute134"easy_install". If you have UAC enabled it should prompt you for admin135privileges.136137138.. _ez_setup.py: http://peak.telecommunity.com/dist/ez_setup.py
modified:docs/quickstart.rst+8 added-3 removed
21 unmodified lines
2223 if __name__ == '__main__':24 app.run()2526If you now start that application with your Python interpreter and head27over to `http://localhost:5000/ <http://localhost:5000/>`_, you should see28your hello world application.26Just save it as `hello.py` or something similar and run it with your27Python interpreter::2829 $ python hello.py30 * Running on http://localhost:5000/3132Head over to `http://localhost:5000/ <http://localhost:5000/>`_, you should33see your hello world greeting.3435So what did that code do?36371. first we imported the :class:`~flask.Flask` class. An instance of this38 class will be our WSGI application.
465 unmodified lines
modified:flask.py+72 added-1 removed
77 unmodified lines
78def flash(message):79 """Flashes a message to the next request. In order to remove the80 flashed message from the session and to display it to the user,81 the template has to call :func:`get_flashed_messages`.8283 :param message: the message to be flashed.84 """85 session['_flashes'] = (session.get('_flashes', [])) + [message]8687
11 unmodified lines
99100def render_template(template_name, **context):101 """Renders a template from the template folder with the given102 context.103104 :param template_name: the name of the template to be rendered105 :param context: the variables that should be available in the106 context of the template.107 """108 current_app.update_template_context(context)109 return current_app.jinja_env.get_template(template_name).render(context)110111112def render_template_string(source, **context):113 """Renders a template from the given template source string114 with the given context.115116 :param template_name: the sourcecode of the template to be117 rendered118 :param context: the variables that should be available in the119 context of the template.120 """121 current_app.update_template_context(context)122 return current_app.jinja_env.from_string(source).render(context)123
108 unmodified lines
232233 def update_template_context(self, context):234 """Update the template context with some commonly used variables.235 This injects request, session and g into the template context.236237 :param context: the context as a dictionary that is updated in place238 to add extra variables.239 """240 reqctx = _request_ctx_stack.top241 context['request'] = reqctx.request242 context['session'] = reqctx.session
2 unmodified lines
245 def run(self, host='localhost', port=5000, **options):246 """Runs the application on a local development server. If the247 :attr:`debug` flag is set the server will automatically reload248 for code changes and show a debugger in case an exception happened.249250 :param host: the hostname to listen on. set this to ``'0.0.0.0'``251 to have the server available externally as well.252 :param port: the port of the webserver253 :param options: the options to be forwarded to the underlying254 Werkzeug server. See :func:`werkzeug.run_simple`255 for more information.256 """257 from werkzeug import run_simple258 if 'debug' in options:259 self.debug = options.pop('debug')
28 unmodified lines
288289 with app.open_resource('schema.sql') as f:290 contents = f.read()291 do_something_with(contents)292293 :param resource: the name of the resource. To access resources within294 subfolders use forward slashes as separator.295 """296 return pkg_resources.resource_stream(self.package_name, resource)297298 def open_session(self, request):299 """Creates or opens a new session. Default implementation stores all300 session data in a signed cookie. This requires that the301 :attr:`secret_key` is set.302303 :param request: an instance of :attr:`request_class`.304 """305 key = self.secret_key306 if key is not None:307 return SecureCookie.load_cookie(request, self.session_cookie_name,
1 unmodified line
309310 def save_session(self, session, response):311 """Saves the session if it needs updates. For the default312 implementation, check :meth:`open_session`.313314 :param session: the session to be saved (a315 :class:`~werkzeug.contrib.securecookie.SecureCookie`316 object)317 :param request: an instance of :attr:`response_class`318 """319 if session is not None:320 session.save_cookie(response, self.session_cookie_name)321
12 unmodified lines
334 def index():335 pass336 app.add_url_rule('index', '/')337 app.view_functions['index'] = index338339 :param rule: the URL rule as string340 :param endpoint: the endpoint for the registered URL rule. Flask341 itself assumes the name of the view function as342 endpoint343 :param options: the options to be forwarded to the underlying344 :class:`~werkzeug.routing.Rule` object345 """346 options['endpoint'] = endpoint347 options.setdefault('methods', ('GET',))348 self.url_map.add(Rule(rule, **options))
51 unmodified lines
400401 The :meth:`route` decorator accepts a couple of other arguments402 as well:403404 :param rule: the URL rule as string405 :param methods: a list of methods this rule should be limited406 to (``GET``, ``POST`` etc.). By default a rule407 just listens for ``GET`` (and implicitly ``HEAD``).408 :param subdomain: specifies the rule for the subdoain in case409 subdomain matching is in use.410 :param strict_slashes: can be used to disable the strict slashes411 setting for this rule. See above.412 :param options: other options to be forwarded to the underlying413 :class:`~werkzeug.routing.Rule` object.414 """415 def decorator(f):416 self.add_url_rule(rule, f.__name__, **options)417 self.view_functions[f.__name__] = f
14 unmodified lines
432433 def page_not_found():434 return 'This page does not exist', 404435 app.error_handlers[404] = page_not_found436437 :param code: the code as integer for the handler438 """439 def decorator(f):440 self.error_handlers[code] = f441 return f
40 unmodified lines
482483 def make_response(self, rv):484 """Converts the return value from a view function to a real485 response object that is an instance of :attr:`response_class`.486487 The following types are allowd for `rv`:488489 ======================= ===========================================490 :attr:`response_class` the object is returned unchanged491 :class:`str` a response object is created with the492 string as body493 :class:`unicode` a response object is created with the494 string encoded to utf-8 as body495 :class:`tuple` the response object is created with the496 contents of the tuple as arguments497 a WSGI function the function is called as WSGI application498 and buffered as response object499 ======================= ===========================================500501 :param rv: the return value from the view function502 """503 if isinstance(rv, self.response_class):504 return rv505 if isinstance(rv, basestring):
16 unmodified lines
522523 def process_response(self, response):524 """Can be overridden in order to modify the response object525 before it's sent to the WSGI server.526527 :param response: a :attr:`response_class` object.528 :return: a new response object or the same, has to be an529 instance of :attr:`response_class`.530 """531 session = _request_ctx_stack.top.session532 if session is not None:533 self.save_session(session, response)
5 unmodified lines
539 """The actual WSGI application. This is not implemented in540 `__call__` so that middlewares can be applied:541542 app.wsgi_app = MyMiddleware(app.wsgi_app)543544 :param environ: a WSGI environment545 :param start_response: a callable accepting a status code,546 a list of headers and an optional547 exception context to start the response548 """549 with self.request_context(environ):550 rv = self.preprocess_request()551 if rv is None:
12 unmodified lines
564 Example usage::565566 with app.request_context(environ):567 do_something_with(request)568569 :params environ: a WSGI environment570 """571 _request_ctx_stack.push(_RequestContext(self, environ))572 try:573 yield
1 unmodified line
575 _request_ctx_stack.pop()576577 def test_request_context(self, *args, **kwargs):578 """Creates a WSGI environment from the given values (see509 :func:`werkzeug.create_environ` for more information).579 :func:`werkzeug.create_environ` for more information, this580 function accepts the same arguments).581 """582 return self.request_context(create_environ(*args, **kwargs))583584 def __call__(self, environ, start_response):
10 unmodified lines