diff options
| author | Éric Araujo <merwok@netwok.org> | 2020-05-05 20:23:49 -0400 |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2020-05-05 20:23:49 -0400 |
| commit | c65d2c03174d5a2d66a7a85974b938070ad01a71 (patch) | |
| tree | 9295bbde87994c9af781c3378afa70420d0f5e8b /src | |
| parent | 254efda1456a707afd36ec8ee505dc1bb76f8a77 (diff) | |
| download | pyramid-c65d2c03174d5a2d66a7a85974b938070ad01a71.tar.gz pyramid-c65d2c03174d5a2d66a7a85974b938070ad01a71.tar.bz2 pyramid-c65d2c03174d5a2d66a7a85974b938070ad01a71.zip | |
reword doc
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/config/routes.py | 30 | ||||
| -rw-r--r-- | src/pyramid/config/views.py | 33 |
2 files changed, 34 insertions, 29 deletions
diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 5daa1dc00..7208f5adb 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -219,24 +219,26 @@ class RoutesConfiguratorMixin: header - This argument represents an HTTP header name or a header - name/value pair, or a sequence of them. - If the argument contains a ``:`` (colon), - it will be considered a name/value pair - (e.g. ``User-Agent:Mozilla/.*`` or ``Host:localhost``). If - the value contains a colon, the value portion should be a - regular expression. If the value does not contain a colon, - the entire value will be considered to be the header name - (e.g. ``If-Modified-Since``). If the value evaluates to a - header name only without a value, the header specified by + This value can be a string or an iterable of strings for HTTP + header names. Any string that does not contain a ``:`` + (colon) will be considered to be the header name (e.g. + ``If-Modified-Since``). In this case, the header specified by the name must be present in the request for this predicate - to be true. If the value evaluates to a header name/value - pair, the header specified by the name must be present in + to be true. + + If a string contains a colon, it will be considered a + name/value pair (e.g. ``User-Agent:Mozilla/.*`` or + ``Host:localhost``), where the value part is a regular + expression. The header specified by the name must be present in the request *and* the regular expression specified as the - value must match the header value. Whether or not the value - represents a header name or a header name/value pair, the + value must match the header value. + + Whether or not the strings + represent a header name or a header name/value pair, the case of the header name is not significant. If this predicate returns ``False``, route matching continues. + When the value is an iterable of strings, they must all + return ``True`` for this predicate to return ``True``. accept diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index 9053160fa..cf1b0a800 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -670,23 +670,26 @@ class ViewsConfiguratorMixin: header - This value represents an HTTP header name or a header - name/value pair, or a sequence of them. - If the value contains a ``:`` (colon), it - will be considered a name/value pair - (e.g. ``User-Agent:Mozilla/.*`` or ``Host:localhost``). The - value portion should be a regular expression. If the value - does not contain a colon, the entire value will be - considered to be the header name - (e.g. ``If-Modified-Since``). If the value evaluates to a - header name only without a value, the header specified by + This value can be a string or an iterable of strings for HTTP + header names. Any string that does not contain a ``:`` + (colon) will be considered to be the header name (e.g. + ``If-Modified-Since``). In this case, the header specified by the name must be present in the request for this predicate - to be true. If the value evaluates to a header name/value - pair, the header specified by the name must be present in + to be true. + + If a string contains a colon, it will be considered a + name/value pair (e.g. ``User-Agent:Mozilla/.*`` or + ``Host:localhost``), where the value part is a regular + expression. The header specified by the name must be present in the request *and* the regular expression specified as the - value must match the header value. Whether or not the value - represents a header name or a header name/value pair, the - case of the header name is not significant. + value must match the header value. + + Whether or not the strings + represent a header name or a header name/value pair, the + case of the header name is not significant. If this + predicate returns ``False``, route matching continues. + When the value is an iterable of strings, they must all + return ``True`` for this predicate to return ``True``. path_info |
