diff options
| author | Ira Lun <sammyrosajoe@gmail.com> | 2017-08-29 19:52:30 +0100 |
|---|---|---|
| committer | Ira Lun <sammyrosajoe@gmail.com> | 2017-08-29 19:52:30 +0100 |
| commit | 326436a92a3aaf7bee9ec7fea74c45e0eb918e39 (patch) | |
| tree | 623d5ffe97d3a59709a462454fc73c64ccd2412c /src/webob | |
| parent | 79555c0d1c62ae1536b5016b718ce69bd3d317a7 (diff) | |
| download | webob-326436a92a3aaf7bee9ec7fea74c45e0eb918e39.tar.gz | |
Add _list_0_or_more__compiled_re.
Diffstat (limited to 'src/webob')
| -rw-r--r-- | src/webob/acceptparse.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/webob/acceptparse.py b/src/webob/acceptparse.py index 27a0772..708ee14 100644 --- a/src/webob/acceptparse.py +++ b/src/webob/acceptparse.py @@ -63,6 +63,18 @@ def _item_qvalue_pair_to_header_element(pair): return element +def _list_0_or_more__compiled_re(element_re): + # RFC 7230 Section 7 "ABNF List Extension: #rule": + # #element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ] + return re.compile( + '^(?:$)|' + + '(?:' + + '(?:,|(?:' + element_re + '))' + + '(?:' + OWS_re + ',(?:' + OWS_re + element_re + ')?)*' + + ')$', + ) + + def _list_1_or_more__compiled_re(element_re): # RFC 7230 Section 7 "ABNF List Extension: #rule": # 1#element => *( "," OWS ) element *( OWS "," [ OWS element ] ) |
