### Server Factory Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Provides a basic structure for a server factory. This factory returns a 'serve' callable which takes a WSGI application and starts a server to host it. ```python def server_factory(global_conf, host, port): port = int(port) def serve(app): s = Server(app, host=host, port=port) s.serve_forever() return serve ``` -------------------------------- ### Python Setup for Eggs Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Change the import statement from distutils.core.setup to setuptools.setup to enable egg installation. ```python from distutils.core import setup ``` ```python from setuptools import setup ``` -------------------------------- ### Application Section Example (External Egg) Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html An example of an application section that references an application from an installed Python egg, with its specific configuration. ```ini [app:blogapp] use = egg:BlogApp database = sqlite:/home/me/blog.db ``` -------------------------------- ### Defining Entry Points in setup() Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Add an entry_points argument to setup() to define applications like 'main' and 'ob2' with their respective factory locations. ```python setup( name='MyApp', # ... entry_points={ 'paste.app_factory': [ 'main=myapp.mymodule:app_factory', 'ob2=myapp.mymodule:ob_factory'], }, ) ``` -------------------------------- ### Application Section Example (Direct Call) Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Shows how to reference an application directly from a Python module using the `call:` syntax. ```ini [app:wiki] use = call:mywiki.main:application database = sqlite:/home/me/wiki.db ``` -------------------------------- ### Install Paste Deploy from source Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Install Paste Deploy locally from its source code repository for development or tracking changes. This uses a development installation. ```bash git clone https://github.com/Pylons/pastedeploy cd pastedeploy pip install -e . ``` -------------------------------- ### Application Section Example (Static Files) Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Shows a simple static file serving application with configuration for the document root. Variable substitution using `%(here)s` is demonstrated. ```ini [app:home] use = egg:Paste#static document_root = %(here)s/htdocs ``` -------------------------------- ### Install Paste Deploy using pip Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Install Paste Deploy using pip. This is the standard method for installing the package. ```bash pip install PasteDeploy ``` -------------------------------- ### Example Paste Deploy Configuration File Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html A typical configuration file demonstrating composite, application, and filter-app sections, including mounting multiple applications. ```ini [composite:main] use = egg:Paste#urlmap / = home /blog = blog /wiki = wiki /cms = config:cms.ini [app:home] use = egg:Paste#static document_root = %(here)s/htdocs [filter-app:blog] use = egg:Authentication#auth next = blogapp roles = admin htpasswd = /home/me/users.htpasswd [app:blogapp] use = egg:BlogApp database = sqlite:/home/me/blog.db [app:wiki] use = call:mywiki.main:application database = sqlite:/home/me/wiki.db ``` -------------------------------- ### Install PasteDeploy using pip Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Install the PasteDeploy package using pip. This is the standard method for installing the library. ```bash pip install PasteDeploy ``` -------------------------------- ### Install PasteDeploy from source Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Install PasteDeploy from a Git checkout for development. This method allows tracking development changes and installing directly from the source code. ```bash git clone https://github.com/Pylons/pastedeploy cd pastedeploy pip install -e . ``` -------------------------------- ### Python Egg Setup for setuptools Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Modifies a distutils setup.py to use setuptools for creating Python Eggs, enabling metadata and entry points. ```python from setuptools import setup ``` -------------------------------- ### WSGI Server Factory Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A factory function that creates and returns a WSGI server callable. The returned callable takes a WSGI application and starts serving it. ```python def server_factory(global_conf, host, port): port = int(port) def serve(app): s = Server(app, host=host, port=port) s.serve_forever() return serve ``` -------------------------------- ### Filter-App Section Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Demonstrates a section for an application with a filter applied, specifying the next application in the chain and filter-specific configurations. ```ini [filter-app:blog] use = egg:Authentication#auth next = blogapp roles = admin htpasswd = /home/me/users.htpasswd ``` -------------------------------- ### Blog Application Configuration Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Defines a specific application, 'blogapp', likely installed via pip. Requires database configuration. ```ini [app:blogapp] use = egg:BlogApp database = sqlite:/home/me/blog.db ``` -------------------------------- ### Example Paste Deploy Configuration File Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A typical Paste Deploy configuration file demonstrating how to mount multiple applications, including static files, authentication filters, and applications loaded from eggs or Python calls. It shows the INI format with sections for composite applications, app factories, filters, and server configurations. ```ini [composite:main] use = egg:Paste#urlmap / = home /blog = blog /wiki = wiki /cms = config:cms.ini [app:home] use = egg:Paste#static document_root = %(here)s/htdocs [filter-app:blog] use = egg:Authentication#auth next = blogapp roles = admin htpasswd = /home/me/users.htpasswd [app:blogapp] use = egg:BlogApp database = sqlite:/home/me/blog.db [app:wiki] use = call:mywiki.main:application database = sqlite:/home/me/wiki.db ``` -------------------------------- ### INI Configuration File Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Illustrates the basic INI format used by PasteDeploy, including sections, key-value pairs, multi-line values, and comments. ```ini [section_name] key = value another key = a long value that extends over multiple lines ``` -------------------------------- ### Configuration Example for Filter Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Illustrates a configuration snippet for defining an application filter. The 'use' directive specifies the factory, and 'next' indicates the subsequent application in the chain. ```ini [app-filter:app_name] use = egg:... next = next_app [app:next_app] # ... ``` -------------------------------- ### Pipeline Factory Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html An example of a composite factory that constructs a WSGI application pipeline from a list of filters and a final application. ```python def pipeline_factory(loader, global_config, pipeline): # space-separated list of filter and app names: pipeline = pipeline.split() filters = [loader.get_filter(n) for n in pipeline[:-1]] app = loader.get_app(pipeline[-1]) filters.reverse() # apply in reverse order! for filter in filters: app = filter(app) return app ``` -------------------------------- ### Composite Section Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Illustrates a composite section that dispatches requests to other applications based on path prefixes. ```ini [composite:main] use = egg:Paste#urlmap / = home /blog = blog /cms = config:cms.ini ``` -------------------------------- ### Referencing an Egg Entry Point Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Illustrates using the 'use' directive to specify an application provided as an entry point within an installed Python egg. ```ini [app:myotherapp] use = egg:MyApp ``` -------------------------------- ### Install PasteScript Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Install the complementary PasteScript package. This package is often used alongside PasteDeploy for script-related functionalities. ```bash pip install PasteScript ``` -------------------------------- ### AuthFilter Class Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt An example AuthFilter class that wraps a WSGI application and checks for required usernames. ```python class AuthFilter(object): ``` -------------------------------- ### Install Paste Script Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Install the complementary Paste Script package using pip. This package is often used alongside Paste Deploy. ```bash pip install PasteScript ``` -------------------------------- ### Composite Application Definition Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Example of a composite application ('urlmap') that combines multiple applications ('mainapp', 'staticapp') mounted at different URL paths. ```ini [composite:main] use = egg:Paste#urlmap / = mainapp /files = staticapp [app:mainapp] use = egg:MyApp [app:staticapp] use = egg:Paste#static document_root = /path/to/docroot ``` -------------------------------- ### WSGI Filter Application Example Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A WSGI filter class that checks for authorized usernames before passing requests to the next application. This serves as an example for `paste.filter_app_factory`. ```python class AuthFilter(object): def __init__(self, app, global_conf, req_usernames): # ... pass def __call__(self, environ, start_response): if environ.get('REMOTE_USER') in self.req_usernames: return self.app(environ, start_response) start_response( '403 Forbidden', [('Content-type', 'text/html')]) return ['You are forbidden to view this resource'] ``` -------------------------------- ### PasteDeploy Configuration for App Filter Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt An example of how to configure an application filter in PasteDeploy's INI format, specifying the egg to use and the next application in the chain. ```ini [app-filter:app_name] use = egg:... next = next_app ``` -------------------------------- ### Configuration with Keyword Arguments Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Illustrates how additional keys in an application's section are passed as keyword arguments to the factory. ```ini [app:blog] use = egg:MyBlog database = mysql://localhost/blogdb blogname = This Is My Blog! ``` -------------------------------- ### Global Configuration and Local Override Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Demonstrates setting global configuration in the '[DEFAULT]' section and overriding specific values locally using the 'set' directive. ```ini [DEFAULT] admin_email = webmaster@example.com [app:main] use = ... set admin_email = bob@example.com ``` -------------------------------- ### Application Configuration Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Configures an application named 'myapp' using the 'egg:MyApp' entry point. ```ini [app:myapp] use = egg:MyApp ``` -------------------------------- ### Static File Serving Application Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Configures a simple application to serve static files. Specifies the document root using variable substitution for the configuration file's directory. ```ini [app:home] use = egg:Paste#static document_root = %(here)s/htdocs ``` -------------------------------- ### loadserver Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/loadwsgi.rst.txt Loads a WSGI server from a configuration file. ```APIDOC ## loadserver ### Description Loads a WSGI server from a configuration file. ### Method Not applicable (Python function) ### Endpoint Not applicable (Python function) ### Parameters This function takes arguments that are not explicitly detailed in the provided source. Refer to the Paste Deploy documentation for detailed parameter information. ### Request Example Not applicable (Python function) ### Response Returns a WSGI server object. #### Success Response (200) - WSGI Server Object (object) - The loaded WSGI server. #### Response Example Not applicable (Python function) ``` -------------------------------- ### Referencing Another Configuration File Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Shows how an application can be defined using a 'use' directive that points to an application defined in another configuration file. ```ini [app:myapp] use = config:another_config_file.ini#app_name ``` -------------------------------- ### Filter Composition with 'filter-with' Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Shows how to apply a filter ('printdebug') to an application ('main') using the 'filter-with' setting. ```ini [app:main] use = egg:MyEgg filter-with = printdebug [filter:printdebug] use = egg:Paste#printdebug ``` -------------------------------- ### Defining Application Factory Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Demonstrates how to define an application by pointing to a specific Python factory function using the 'paste.app_factory' protocol. ```ini [app:myapp] paste.app_factory = myapp.modulename:app_factory ``` -------------------------------- ### Passing configuration arguments to a factory Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Any keys in the application section besides 'use' or the protocol name are passed as keyword arguments to the factory function. ```ini [app:blog] use = egg:MyBlog database = mysql://localhost/blogdb blogname = This Is My Blog! ``` -------------------------------- ### loadapp Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/loadwsgi.rst.txt Loads a WSGI application from a configuration file. ```APIDOC ## loadapp ### Description Loads a WSGI application from a configuration file. ### Method Not applicable (Python function) ### Endpoint Not applicable (Python function) ### Parameters This function takes arguments that are not explicitly detailed in the provided source. Refer to the Paste Deploy documentation for detailed parameter information. ### Request Example Not applicable (Python function) ### Response Returns a WSGI application object. #### Success Response (200) - WSGI Application Object (object) - The loaded WSGI application. #### Response Example Not applicable (Python function) ``` -------------------------------- ### Load WSGI Application using Paste Deploy Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Demonstrates the basic usage of `paste.deploy.loadapp` to load a WSGI application from a configuration URI. ```python from paste.deploy import loadapp wsgi_app = loadapp('config:/path/to/config.ini') ``` -------------------------------- ### loadserver Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/loadwsgi.html Loads a WSGI server from a configuration file specified by a URI. ```APIDOC ## loadserver ### Description Loads a WSGI server from a configuration file specified by a URI. ### Method Not specified (likely a Python function call). ### Endpoint Not applicable (Python function). ### Parameters * **_uri_** (string) - Required - The URI of the configuration file. * **_name_** (string) - Optional - The name of the server to load. * **_** kw_** (dict) - Optional - Additional keyword arguments. ### Request Example ```python from paste.deploy import loadwsgi server = loadwsgi.loadserver('config:paste.ini') ``` ### Response * **server** (WSGI Server) - The loaded WSGI server. ``` -------------------------------- ### Filtered Application with Authentication Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Sets up an application with a filter, such as authentication. The 'next' key specifies the application to be filtered. Requires a htpasswd file for authentication. ```ini [filter-app:blog] use = egg:Authentication#auth next = blogapp roles = admin htpasswd = /home/me/users.htpasswd ``` -------------------------------- ### Allow Variable Setting in Paste Deploy Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.html Demonstrates how to bring global variables into the local scope using a specific syntax in Paste Deploy configuration files. ```ini get local_var = global_var_name ``` -------------------------------- ### Interpolation in PasteDeploy Configuration Files Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/news.rst.txt Shows how to use interpolation with the special 'here' value and variables from the [DEFAULTS] section or the same section. ```ini Anything in the "[DEFAULTS]" section will be available to substitute into a value, as will variables in the same section. Also, the special value "here" will be the directory the configuration file is located in. ``` -------------------------------- ### Overriding Configuration in Other Sections Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Shows how to inherit and override settings from another application's configuration section. ```ini [app:otherblog] use = blog blogname = The other face of my blog ``` -------------------------------- ### loadapp Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/loadwsgi.html Loads a WSGI application from a configuration file specified by a URI. ```APIDOC ## loadapp ### Description Loads a WSGI application from a configuration file specified by a URI. ### Method Not specified (likely a Python function call). ### Endpoint Not applicable (Python function). ### Parameters * **_uri_** (string) - Required - The URI of the configuration file. * **_name_** (string) - Optional - The name of the application to load. * **_** kw_** (dict) - Optional - Additional keyword arguments. ### Request Example ```python from paste.deploy import loadwsgi app = loadwsgi.loadapp('config:paste.ini') ``` ### Response * **app** (WSGI Application) - The loaded WSGI application. ``` -------------------------------- ### appconfig Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/loadwsgi.rst.txt Loads application configuration from a configuration file. ```APIDOC ## appconfig ### Description Loads application configuration from a configuration file. ### Method Not applicable (Python function) ### Endpoint Not applicable (Python function) ### Parameters This function takes arguments that are not explicitly detailed in the provided source. Refer to the Paste Deploy documentation for detailed parameter information. ### Request Example Not applicable (Python function) ### Response Returns an application configuration object. #### Success Response (200) - Application Configuration Object (object) - The loaded application configuration. #### Response Example Not applicable (Python function) ``` -------------------------------- ### Composite Configuration Using Pipeline Factory Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Configures a composite application named 'main' using a pipeline factory. It specifies the pipeline of filters and applications to be used. ```ini [composite:main] use = pipeline = egg:Paste#printdebug session myapp ``` -------------------------------- ### Defining a static file application Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt An application configured to serve static files from a specified document root. ```ini [app:staticapp] use = egg:Paste#static document_root = /path/to/docroot ``` -------------------------------- ### Defining Applications with 'use' directive Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Shows different ways to specify the Python code for an application using the 'use' directive, including referencing other config files, eggs, callables, or other sections. ```ini [app:myapp] use = config:another_config_file.ini#app_name # or any URI: [app:myotherapp] use = egg:MyApp # or a callable from a module: [app:mythirdapp] use = call:my.project:myapplication # or even another section: [app:mylastapp] use = myotherapp ``` -------------------------------- ### Defining Entry Points for PasteDeploy Applications Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Specifies entry points for PasteDeploy applications within a Python Egg's setup.py. 'paste.app_factory' is used to register application factories. ```python setup( name='MyApp', # ... entry_points={ 'paste.app_factory': [ 'main=myapp.mymodule:app_factory', 'ob2=myapp.mymodule:ob_factory'], }, ) ``` -------------------------------- ### Setting global configuration defaults Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt The [DEFAULT] section specifies global configuration values that apply to all applications unless overridden locally. ```ini [DEFAULT] admin_email = webmaster@example.com ``` -------------------------------- ### Configure PrefixMiddleware in .ini file Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/config.html This snippet shows how to configure the PrefixMiddleware in a Paste Deploy .ini file to handle URL prefixes, typically when an application is behind a reverse proxy. ```ini filter-with = proxy-prefix [filter:proxy-prefix] use = egg:PasteDeploy#prefix prefix = /james ``` -------------------------------- ### appconfig Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/loadwsgi.html Retrieves the configuration for a WSGI application from a configuration file. ```APIDOC ## appconfig ### Description Retrieves the configuration for a WSGI application from a configuration file. ### Method Not specified (likely a Python function call). ### Endpoint Not applicable (Python function). ### Parameters * **_uri_** (string) - Required - The URI of the configuration file. * **_name_** (string) - Optional - The name of the application configuration to retrieve. * **relative_to** (string) - Optional - The base path for relative URIs. * **global_conf** (dict) - Optional - Global configuration settings. ### Request Example ```python from paste.deploy import loadwsgi config = loadwsgi.appconfig('config:paste.ini', name='main') ``` ### Response * **config** (dict) - The application configuration. ``` -------------------------------- ### Referencing another application section Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt You can reference another application section using the 'use' directive. This allows for configuration inheritance and modularity. ```ini [app:mylastapp] use = myotherapp ``` -------------------------------- ### Defining a filter-app Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A 'filter-app' section defines a filter and the application it should be applied to using the 'next' key. ```ini [filter-app:main] use = filter1 next = app ``` -------------------------------- ### Defining a simple application for a composite Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A basic application definition that can be referenced by a composite application. ```ini [app:mainapp] use = egg:MyApp ``` -------------------------------- ### Defining a composite application with URL mapping Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Composite applications like URL mappers can be defined to mount other applications at different URL paths. ```ini [composite:main] use = egg:Paste#urlmap / = mainapp /files = staticapp ``` -------------------------------- ### Referencing a Callable from a Module Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Demonstrates using the 'use' directive to directly specify a callable (application) from a Python module. ```ini [app:mythirdapp] use = call:mywiki.main:application ``` -------------------------------- ### Direct Callable Application Reference Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt References a WSGI application directly via a callable in a Python module. The format is 'module.path:callable_name'. ```ini [app:wiki] use = call:mywiki.main:application database = sqlite:/home/me/wiki.db ``` -------------------------------- ### loadfilter Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/loadwsgi.rst.txt Loads a WSGI filter from a configuration file. ```APIDOC ## loadfilter ### Description Loads a WSGI filter from a configuration file. ### Method Not applicable (Python function) ### Endpoint Not applicable (Python function) ### Parameters This function takes arguments that are not explicitly detailed in the provided source. Refer to the Paste Deploy documentation for detailed parameter information. ### Request Example Not applicable (Python function) ### Response Returns a WSGI filter object. #### Success Response (200) - WSGI Filter Object (object) - The loaded WSGI filter. #### Response Example Not applicable (Python function) ``` -------------------------------- ### Session Filter Configuration Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Configures a filter named 'session' using the 'egg:Paste#session' entry point, specifying 'memory' as the store. ```ini [filter:session] use = egg:Paste#session store = memory ``` -------------------------------- ### Overriding global configuration locally Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Global configuration values can be overridden for a specific application using the 'set' prefix. ```ini [app:main] use = ... set admin_email = bob@example.com ``` -------------------------------- ### Applying a filter using filter-with Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt The 'filter-with' setting applies a specified filter to an application. Multiple filters can be chained. ```ini [app:main] use = egg:MyEgg filter-with = printdebug ``` -------------------------------- ### PasteDeploy Configuration for Pipeline Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt INI configuration for a composite application named 'main' that uses a pipeline, specifying filters and the main application. ```ini [composite:main] use = pipeline = egg:Paste#printdebug session myapp [filter:session] use = egg:Paste#session store = memory [app:myapp] use = egg:MyApp ``` -------------------------------- ### Pipeline Application Configuration Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Defines a pipeline of filters and an application. The 'pipeline' key specifies a space-separated list of filters and the final application. ```ini [pipeline:main] pipeline = filter1 egg:FilterEgg#filter2 filter3 app ``` -------------------------------- ### loadfilter Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/loadwsgi.html Loads a WSGI filter from a configuration file specified by a URI. ```APIDOC ## loadfilter ### Description Loads a WSGI filter from a configuration file specified by a URI. ### Method Not specified (likely a Python function call). ### Endpoint Not applicable (Python function). ### Parameters * **_uri_** (string) - Required - The URI of the configuration file. * **_name_** (string) - Optional - The name of the filter to load. * **_** kw_** (dict) - Optional - Additional keyword arguments. ### Request Example ```python from paste.deploy import loadwsgi filter_app = loadwsgi.loadfilter('config:paste.ini') ``` ### Response * **filter_app** (WSGI Filter) - The loaded WSGI filter. ``` -------------------------------- ### Overriding configuration settings Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Configuration settings can be overridden in other sections by referencing the original section and providing new values. ```ini [app:otherblog] use = blog blogname = The other face of my blog ``` -------------------------------- ### WSGI Application Factory Signature Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Defines the signature for a WSGI application factory function. It accepts global configuration and local configuration keywords, returning a WSGI application. ```python def app_factory(global_config, **local_conf): return wsgi_app ``` -------------------------------- ### Composite Application Mapping Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Defines a composite application that dispatches requests to other applications based on path prefixes. Uses the 'urlmap' composite from the Paste package. ```ini [composite:main] use = egg:Paste#urlmap / = home /blog = blog /cms = config:cms.ini ``` -------------------------------- ### aslist Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/converters.rst.txt Converts a string value to a list of strings. ```APIDOC ## aslist ### Description Converts a string value to a list of strings. Splits the string by commas by default. Whitespace around elements is stripped. ### Function Signature `aslist(value)` ### Parameters - **value** (string) - The string to convert. ### Returns - (list of strings) - The list representation of the input string. ``` -------------------------------- ### asint Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/converters.html Converts an object to an integer value. This function is helpful for parsing string configurations into integer settings. ```APIDOC ## asint ### Description Converts an object to an integer value. This function is helpful for parsing string configurations into integer settings. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **int** (int) - The integer representation of the input object. ### Response Example None ``` -------------------------------- ### Composite Factory Signature Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Defines the signature for a composite factory function. It accepts a loader object, global configuration, and local configuration keywords, returning a WSGI application. ```python def composite_factory(loader, global_config, **local_conf): return wsgi_app ``` -------------------------------- ### asbool Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/converters.html Converts an object to a boolean value. This is useful for parsing string configurations into boolean settings. ```APIDOC ## asbool ### Description Converts an object to a boolean value. This is useful for parsing string configurations into boolean settings. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **bool** (bool) - The boolean representation of the input object. ### Response Example None ``` -------------------------------- ### Paste.filter_factory Signature Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt Defines the signature for a paste.filter_factory, which is similar to app_factory but returns a WSGI filter. ```python def auth_filter_factory(global_conf, req_usernames): # space-separated list of usernames: req_usernames = req_usernames.split() def filter(app): return AuthFilter(app, req_usernames) return filter ``` -------------------------------- ### asint Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/converters.rst.txt Converts a string value to an integer. ```APIDOC ## asint ### Description Converts a string value to an integer. Raises a ValueError if the string cannot be converted. ### Function Signature `asint(value)` ### Parameters - **value** (string) - The string to convert. ### Returns - (integer) - The integer representation of the input string. ``` -------------------------------- ### aslist Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/converters.html Converts an object to a list value, optionally splitting by a separator and stripping whitespace. This is useful for parsing comma-separated or other delimited string configurations into lists. ```APIDOC ## aslist ### Description Converts an object to a list value, optionally splitting by a separator and stripping whitespace. This is useful for parsing comma-separated or other delimited string configurations into lists. ### Parameters #### Path Parameters None #### Query Parameters - **sep** (string) - Optional - The separator to split the string by. If None, the string is treated as a single element list. - **strip** (bool) - Optional - Whether to strip whitespace from each element after splitting. Defaults to True. #### Request Body None ### Request Example None ### Response #### Success Response - **list** (list) - The list representation of the input object. ### Response Example None ``` -------------------------------- ### asbool Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/modules/converters.rst.txt Converts a string value to a boolean. ```APIDOC ## asbool ### Description Converts a string value to a boolean. Recognizes 'true', 'yes', 'on', '1' as True, and 'false', 'no', 'off', '0' as False. Case-insensitive. ### Function Signature `asbool(value)` ### Parameters - **value** (string) - The string to convert. ### Returns - (boolean) - The boolean representation of the input string. ``` -------------------------------- ### Authentication Filter Factory Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/index.html Defines a filter factory that creates an authentication filter. Use this when you need to wrap a WSGI application with authentication logic based on the REMOTE_USER environment variable. ```python def auth_filter_factory(global_conf, req_usernames): # space-separated list of usernames: req_usernames = req_usernames.split() def filter (app): return AuthFilter(app, req_usernames) return filter class AuthFilter(object): def __init__(self, app, req_usernames): self.app = app self.req_usernames = req_usernames def __call__(self, environ, start_response): if environ.get('REMOTE_USER') in self.req_usernames: return self.app(environ, start_response) start_response( '403 Forbidden', [('Content-type', 'text/html')]) return ['You are forbidden to view this resource'] ``` -------------------------------- ### Defining a filter Source: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/_sources/index.rst.txt A filter section defines a reusable filter component that can be applied to applications. ```ini [filter:printdebug] use = egg:Paste#printdebug ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.