From ad011bc32d7b9160354efafcd43e20f7042a6a13 Mon Sep 17 00:00:00 2001 From: defuz Date: Wed, 5 Nov 2014 07:10:49 +0300 Subject: [PATCH] docs: ``DEBUG``, ``SERVER_NAME``, ``PATH_INFO`` --- CHANGES | 12 ++++++------ docs/config.rst | 6 +++--- docs/deploying/fastcgi.rst | 2 +- docs/deploying/uwsgi.rst | 2 +- docs/deploying/wsgi-standalone.rst | 4 ++-- docs/patterns/fabric.rst | 2 +- docs/patterns/fileuploads.rst | 6 +++--- flask/app.py | 16 ++++++++-------- flask/ctx.py | 2 +- flask/helpers.py | 2 +- flask/wrappers.py | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CHANGES b/CHANGES index ac90e9b8..86c79c7c 100644 --- a/CHANGES +++ b/CHANGES @@ -339,10 +339,10 @@ Released on June 28th 2011, codename Grappa 1.0 the old behavior will continue to work but issue dependency warnings. - fixed a problem for Flask to run on jython. -- added a `PROPAGATE_EXCEPTIONS` configuration variable that can be +- added a ``PROPAGATE_EXCEPTIONS`` configuration variable that can be used to flip the setting of exception propagation which previously - was linked to `DEBUG` alone and is now linked to either `DEBUG` or - `TESTING`. + was linked to ``DEBUG`` alone and is now linked to either ``DEBUG`` or + ``TESTING``. - Flask no longer internally depends on rules being added through the `add_url_rule` function and can now also accept regular werkzeug rules added to the url map. @@ -450,7 +450,7 @@ Released on July 6th 2010, codename Calvados - fixed a bug with subdomains that was caused by the inability to specify the server name. The server name can now be set with - the `SERVER_NAME` config key. This key is now also used to set + the ``SERVER_NAME`` config key. This key is now also used to set the session cookie cross-subdomain wide. - autoescaping is no longer active for all templates. Instead it is only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``. @@ -482,8 +482,8 @@ Released on June 18th 2010, codename Rakia requests that do not pop the request stack for testing. - because the Python standard library caches loggers, the name of the logger is configurable now to better support unittests. -- added `TESTING` switch that can activate unittesting helpers. -- the logger switches to `DEBUG` mode now if debug is enabled. +- added ``TESTING`` switch that can activate unittesting helpers. +- the logger switches to ``DEBUG`` mode now if debug is enabled. Version 0.3.1 ------------- diff --git a/docs/config.rst b/docs/config.rst index 45362eaf..07d8735c 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -57,8 +57,8 @@ The following configuration values are used internally by Flask: ``PROPAGATE_EXCEPTIONS`` explicitly enable or disable the propagation of exceptions. If not set or explicitly set to ``None`` this is - implicitly true if either `TESTING` or - `DEBUG` is true. + implicitly true if either ``TESTING`` or + ``DEBUG`` is true. ``PRESERVE_CONTEXT_ON_EXCEPTION`` By default if the application is in debug mode the request context is not popped on exceptions to enable debuggers @@ -260,7 +260,7 @@ So a common pattern is this:: This first loads the configuration from the `yourapplication.default_settings` module and then overrides the values -with the contents of the file the :envvar:`YOURAPPLICATION_SETTINGS` +with the contents of the file the :envvar:``YOURAPPLICATION_SETTINGS`` environment variable points to. This environment variable can be set on Linux or OS X with the export command in the shell before starting the server:: diff --git a/docs/deploying/fastcgi.rst b/docs/deploying/fastcgi.rst index a3b83279..d9bfc415 100644 --- a/docs/deploying/fastcgi.rst +++ b/docs/deploying/fastcgi.rst @@ -182,7 +182,7 @@ A basic Flask FastCGI configuration for nginx looks like this:: This configuration binds the application to `/yourapplication`. If you want to have it in the URL root it's a bit simpler because you don't -have to figure out how to calculate `PATH_INFO` and `SCRIPT_NAME`:: +have to figure out how to calculate ``PATH_INFO`` and ``SCRIPT_NAME``:: location / { try_files $uri @yourapplication; } location @yourapplication { diff --git a/docs/deploying/uwsgi.rst b/docs/deploying/uwsgi.rst index 25ed8008..51f2d4f7 100644 --- a/docs/deploying/uwsgi.rst +++ b/docs/deploying/uwsgi.rst @@ -53,7 +53,7 @@ A basic flask uWSGI configuration for nginx looks like this:: This configuration binds the application to `/yourapplication`. If you want to have it in the URL root it's a bit simpler because you don't have to tell -it the WSGI `SCRIPT_NAME` or set the uwsgi modifier to make use of it:: +it the WSGI ``SCRIPT_NAME`` or set the uwsgi modifier to make use of it:: location / { try_files $uri @yourapplication; } location @yourapplication { diff --git a/docs/deploying/wsgi-standalone.rst b/docs/deploying/wsgi-standalone.rst index 77a564a2..0375acd1 100644 --- a/docs/deploying/wsgi-standalone.rst +++ b/docs/deploying/wsgi-standalone.rst @@ -74,8 +74,8 @@ Proxy Setups If you deploy your application using one of these servers behind an HTTP proxy you will need to rewrite a few headers in order for the application to work. -The two problematic values in the WSGI environment usually are `REMOTE_ADDR` -and `HTTP_HOST`. You can configure your httpd to pass these headers, or you +The two problematic values in the WSGI environment usually are ``REMOTE_ADDR`` +and ``HTTP_HOST``. You can configure your httpd to pass these headers, or you can fix them in middleware. Werkzeug ships a fixer that will solve some common setups, but you might want to write your own WSGI middleware for specific setups. diff --git a/docs/patterns/fabric.rst b/docs/patterns/fabric.rst index 48915a39..73b6d1ba 100644 --- a/docs/patterns/fabric.rst +++ b/docs/patterns/fabric.rst @@ -142,7 +142,7 @@ The Configuration File ---------------------- Now as mentioned above, the application will find the correct -configuration file by looking up the `YOURAPPLICATION_CONFIG` environment +configuration file by looking up the ``YOURAPPLICATION_CONFIG`` environment variable. So we have to put the configuration in a place where the application will able to find it. Configuration files have the unfriendly quality of being different on all computers, so you do not version them diff --git a/docs/patterns/fileuploads.rst b/docs/patterns/fileuploads.rst index 00f44a93..358f8138 100644 --- a/docs/patterns/fileuploads.rst +++ b/docs/patterns/fileuploads.rst @@ -32,8 +32,8 @@ bootstrapping code for our application:: So first we need a couple of imports. Most should be straightforward, the :func:`werkzeug.secure_filename` is explained a little bit later. The -`UPLOAD_FOLDER` is where we will store the uploaded files and the -`ALLOWED_EXTENSIONS` is the set of allowed file extensions. Then we add a +``UPLOAD_FOLDER`` is where we will store the uploaded files and the +``ALLOWED_EXTENSIONS`` is the set of allowed file extensions. Then we add a URL rule by hand to the application. Now usually we're not doing that, so why here? The reasons is that we want the webserver (or our development server) to serve these files for us and so we only need a rule to generate @@ -98,7 +98,7 @@ before storing it directly on the filesystem. filename = "../../../../home/username/.bashrc" Assuming the number of ``../`` is correct and you would join this with - the `UPLOAD_FOLDER` the user might have the ability to modify a file on + the ``UPLOAD_FOLDER`` the user might have the ability to modify a file on the server's filesystem he or she should not modify. This does require some knowledge about how the application looks like, but trust me, hackers are patient :) diff --git a/flask/app.py b/flask/app.py index ba5ec385..431d39fa 100644 --- a/flask/app.py +++ b/flask/app.py @@ -198,7 +198,7 @@ class Flask(_PackageBoundObject): #: exception occurs and the integrated server will automatically reload #: the application if changes in the code are detected. #: - #: This attribute can also be configured from the config with the `DEBUG` + #: This attribute can also be configured from the config with the ``DEBUG`` #: configuration key. Defaults to ``False``. debug = ConfigAttribute('DEBUG') @@ -211,7 +211,7 @@ class Flask(_PackageBoundObject): #: default it's implicitly enabled. #: #: This attribute can also be configured from the config with the - #: `TESTING` configuration key. Defaults to ``False``. + #: ``TESTING`` configuration key. Defaults to ``False``. testing = ConfigAttribute('TESTING') #: If a secret key is set, cryptographic components can use this to @@ -219,13 +219,13 @@ class Flask(_PackageBoundObject): #: when you want to use the secure cookie for instance. #: #: This attribute can also be configured from the config with the - #: `SECRET_KEY` configuration key. Defaults to ``None``. + #: ``SECRET_KEY`` configuration key. Defaults to ``None``. secret_key = ConfigAttribute('SECRET_KEY') #: The secure cookie uses this for the name of the session cookie. #: #: This attribute can also be configured from the config with the - #: `SESSION_COOKIE_NAME` configuration key. Defaults to ``'session'`` + #: ``SESSION_COOKIE_NAME`` configuration key. Defaults to ``'session'`` session_cookie_name = ConfigAttribute('SESSION_COOKIE_NAME') #: A :class:`~datetime.timedelta` which is used to set the expiration @@ -233,7 +233,7 @@ class Flask(_PackageBoundObject): #: permanent session survive for roughly one month. #: #: This attribute can also be configured from the config with the - #: `PERMANENT_SESSION_LIFETIME` configuration key. Defaults to + #: ``PERMANENT_SESSION_LIFETIME`` configuration key. Defaults to #: ``timedelta(days=31)`` permanent_session_lifetime = ConfigAttribute('PERMANENT_SESSION_LIFETIME', get_converter=_make_timedelta) @@ -245,7 +245,7 @@ class Flask(_PackageBoundObject): #: .. versionadded:: 0.2 #: #: This attribute can also be configured from the config with the - #: `USE_X_SENDFILE` configuration key. Defaults to ``False``. + #: ``USE_X_SENDFILE`` configuration key. Defaults to ``False``. use_x_sendfile = ConfigAttribute('USE_X_SENDFILE') #: The name of the logger to use. By default the logger name is the @@ -560,7 +560,7 @@ class Flask(_PackageBoundObject): @property def propagate_exceptions(self): - """Returns the value of the `PROPAGATE_EXCEPTIONS` configuration + """Returns the value of the ``PROPAGATE_EXCEPTIONS`` configuration value in case it's set, otherwise a sensible default is returned. .. versionadded:: 0.7 @@ -572,7 +572,7 @@ class Flask(_PackageBoundObject): @property def preserve_context_on_exception(self): - """Returns the value of the `PRESERVE_CONTEXT_ON_EXCEPTION` + """Returns the value of the ``PRESERVE_CONTEXT_ON_EXCEPTION`` configuration value in case it's set, otherwise a sensible default is returned. diff --git a/flask/ctx.py b/flask/ctx.py index b8285112..5041a640 100644 --- a/flask/ctx.py +++ b/flask/ctx.py @@ -209,7 +209,7 @@ class RequestContext(object): for you. In debug mode the request context is kept around if exceptions happen so that interactive debuggers have a chance to introspect the data. With 0.4 this can also be forced for requests - that did not fail and outside of `DEBUG` mode. By setting + that did not fail and outside of ``DEBUG`` mode. By setting ``'flask._preserve_context'`` to ``True`` on the WSGI environment the context will not pop itself at the end of the request. This is used by the :meth:`~flask.Flask.test_client` for example to implement the diff --git a/flask/helpers.py b/flask/helpers.py index 3daccf6d..12e3d33a 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -245,7 +245,7 @@ def url_for(endpoint, **values): :param endpoint: the endpoint of the URL (name of the function) :param values: the variable arguments of the URL rule :param _external: if set to ``True``, an absolute URL is generated. Server - address can be changed via `SERVER_NAME` configuration variable which + address can be changed via ``SERVER_NAME`` configuration variable which defaults to `localhost`. :param _scheme: a string specifying the desired URL scheme. The `_external` parameter must be set to ``True`` or a `ValueError` is raised. The default diff --git a/flask/wrappers.py b/flask/wrappers.py index e8d77b21..110a99c3 100644 --- a/flask/wrappers.py +++ b/flask/wrappers.py @@ -62,7 +62,7 @@ class Request(RequestBase): @property def max_content_length(self): - """Read-only view of the `MAX_CONTENT_LENGTH` config key.""" + """Read-only view of the ``MAX_CONTENT_LENGTH`` config key.""" ctx = _request_ctx_stack.top if ctx is not None: return ctx.app.config['MAX_CONTENT_LENGTH']