10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# updated by the app-specific router from applications/app/routes.py routers (if any)
#
#
# Router members:
#
# default_application: default application name
# applications: list of all recognized applications, or 'ALL' to use all currently installed applications
# Names in applications are always treated as an application names when they appear first in an incoming URL.
# Set applications=None to disable the removal of application names from outgoing URLs.
# domains: optional dict mapping domain names to application names
# The domain name can include a port number: domain.com:8080
# The application name can include a controller: appx/ctlrx
# Example:
# domains = { "domain.com" : "app",
# "x.domain.com" : "appx",
# },
# path_prefix: a path fragment that is prefixed to all outgoing URLs and stripped from all incoming URLs
#
# Note: default_application, applications, domains & path_prefix are permitted only in the BASE router,
# and domain makes sense only in an application-specific router.
# The remaining members can appear in the BASE router (as defaults for all applications)
# or in application-specific routers.
#
# default_controller: name of default controller
# default_function: name of default function (in all controllers)
# controllers: list of valid controllers in selected app
# or "DEFAULT" to use all controllers in the selected app plus 'static'
# or None to disable controller-name removal.
# Names in controllers are always treated as controller names when they appear in an incoming URL after
# the (optional) application and language names.
# functions: list of valid functions in the default controller (default None)
# If present, the default function name will be omitted when the controller is the default controller
# and the first arg does not create an ambiguity.
# languages: list of all supported languages
# Names in languages are always treated as language names when they appear in an incoming URL after
# the (optional) application name.
# default_language
# The language code (for example: en, it-it) optionally appears in the URL following
# the application (which may be omitted). For incoming URLs, the code is copied to
# request.language; for outgoing URLs it is taken from request.language.
# If languages=None, language support is disabled.
# The default_language, if any, is omitted from the URL.
# root_static: list of static files accessed from root (by default, favicon.ico & robots.txt)
# (mapped to the default application's static/ directory)
# Each default (including domain-mapped) application has its own root-static files.
# domain: the domain that maps to this application (alternative to using domains in the BASE router)
# exclusive_domain: If True (default is False), an exception is raised if an attempt is made to generate
# an outgoing URL with a different application without providing an explicit host.
# map_hyphen: If True (default is False), hyphens in incoming /a/c/f fields are converted
# to underscores, and back to hyphens in outgoing URLs.
# Language, args and the query string are not affected.
# map_static: By default, the default application is not stripped from static URLs.
# Set map_static=True to override this policy.
# acfe_match: regex for valid application, controller, function, extension /a/c/f.e
# file_match: regex for valid file (used for static file names)
# args_match: regex for valid args
# This validation provides a measure of security.
# If it is changed, the application perform its own validation.
#
#
# The built-in default router supplies default values (undefined members are None):
#
# default_router = dict(
# default_application = 'init',
|
|
|
|
|
>
|
|
|
|
>
|
|
>
|
|
|
|
|
|
|
|
|
|
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# updated by the app-specific router from applications/app/routes.py routers (if any)
#
#
# Router members:
#
# default_application: default application name
# applications: list of all recognized applications, or 'ALL' to use all currently installed applications
# Names in applications are always treated as an application names when they appear first in an incoming URL.
# Set applications=None to disable the removal of application names from outgoing URLs.
# domains: optional dict mapping domain names to application names
# The domain name can include a port number: domain.com:8080
# The application name can include a controller: appx/ctlrx
# or a controller and a function: appx/ctlrx/fcnx
# Example:
# domains = { "domain.com" : "app",
# "x.domain.com" : "appx",
# },
# path_prefix: a path fragment that is prefixed to all outgoing URLs and stripped from all incoming URLs
#
# Note: default_application, applications, domains & path_prefix are permitted only in the BASE router,
# and domain makes sense only in an application-specific router.
# The remaining members can appear in the BASE router (as defaults for all applications)
# or in application-specific routers.
#
# default_controller: name of default controller
# default_function: name of default function (in all controllers) or dictionary of default functions
# by controller
# controllers: list of valid controllers in selected app
# or "DEFAULT" to use all controllers in the selected app plus 'static'
# or None to disable controller-name removal.
# Names in controllers are always treated as controller names when they appear in an incoming URL after
# the (optional) application and language names.
# functions: list of valid functions in the default controller (default None) or dictionary of valid
# functions by controller.
# If present, the default function name will be omitted when the controller is the default controller
# and the first arg does not create an ambiguity.
# languages: list of all supported languages
# Names in languages are always treated as language names when they appear in an incoming URL after
# the (optional) application name.
# default_language
# The language code (for example: en, it-it) optionally appears in the URL following
# the application (which may be omitted). For incoming URLs, the code is copied to
# request.language; for outgoing URLs it is taken from request.language.
# If languages=None, language support is disabled.
# The default_language, if any, is omitted from the URL.
# root_static: list of static files accessed from root (by default, favicon.ico & robots.txt)
# (mapped to the default application's static/ directory)
# Each default (including domain-mapped) application has its own root-static files.
# domain: the domain that maps to this application (alternative to using domains in the BASE router)
# exclusive_domain: If True (default is False), an exception is raised if an attempt is made to generate
# an outgoing URL with a different application without providing an explicit host.
# map_hyphen: If True (default is False), hyphens in incoming /a/c/f fields are converted
# to underscores, and back to hyphens in outgoing URLs.
# Language, args and the query string are not affected.
# map_static: By default, the default application is not stripped from static URLs.
# Set map_static=True to override this policy.
# acfe_match: regex for valid application, controller, function, extension /a/c/f.e
# file_match: regex for valid file (used for static file names)
# args_match: regex for valid args
# This validation provides a measure of security.
# If it is changed, the application perform its own validation.
#
#
# The built-in default router supplies default values (undefined members are None):
#
# default_router = dict(
# default_application = 'init',
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
'/appadmin'
>>> filter_url('http://domain.com/welcome/default/fcn?query', out=True)
'/fcn?query'
>>> filter_url('http://domain.com/welcome/default/fcn#anchor', out=True)
'/fcn#anchor'
>>> filter_url('http://domain.com/welcome/default/fcn?query#anchor', out=True)
'/fcn?query#anchor'
>>> filter_err(200)
200
>>> filter_err(399)
399
>>> filter_err(400)
400
'''
pass
if __name__ == '__main__':
import doctest
doctest.testmod()
|
|
>
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
'/appadmin'
>>> filter_url('http://domain.com/welcome/default/fcn?query', out=True)
'/fcn?query'
>>> filter_url('http://domain.com/welcome/default/fcn#anchor', out=True)
'/fcn#anchor'
>>> filter_url('http://domain.com/welcome/default/fcn?query#anchor', out=True)
'/fcn?query#anchor'
>>> filter_err(200)
200
>>> filter_err(399)
399
>>> filter_err(400)
400
'''
pass
if __name__ == '__main__':
import doctest
doctest.testmod()
|