mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-03 15:38:59 +00:00
Fix a number of incorrect escapes
Pointed out by newer versions of pep8, but they were never correct.
This commit is contained in:
@ -16,7 +16,7 @@ log = logging.getLogger(__name__)
|
|||||||
def _clean_username(username):
|
def _clean_username(username):
|
||||||
username = username.lower()
|
username = username.lower()
|
||||||
|
|
||||||
if not re.match('^[a-z0-9\.-]+$', username):
|
if not re.match(r'^[a-z0-9\.-]+$', username):
|
||||||
# XXX: Note! Should we ever allow @ signs in usernames again, we need to also
|
# XXX: Note! Should we ever allow @ signs in usernames again, we need to also
|
||||||
# update util/auth.py and the code for identifying email addresses.
|
# update util/auth.py and the code for identifying email addresses.
|
||||||
raise forms.ValidationError("Invalid character in user name. Only a-z, 0-9, . and - allowed for compatibility with third party software.")
|
raise forms.ValidationError("Invalid character in user name. Only a-z, 0-9, . and - allowed for compatibility with third party software.")
|
||||||
|
@ -244,9 +244,9 @@ def release_notes(request, major_version=None, minor_version=None):
|
|||||||
SELECT
|
SELECT
|
||||||
{content}
|
{content}
|
||||||
file,
|
file,
|
||||||
string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v
|
string_to_array(regexp_replace(file, 'release-(.*)\\.htm.*', '\\1'), '-') AS v
|
||||||
FROM docs
|
FROM docs
|
||||||
WHERE file ~ '^release-\d+' AND version >= 9.3
|
WHERE file ~ '^release-\\d+' AND version >= 9.3
|
||||||
) r
|
) r
|
||||||
) rr
|
) rr
|
||||||
"""
|
"""
|
||||||
|
@ -20,7 +20,7 @@ component_choices = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
re_cve = re.compile('^(\d{4})-(\d{4,5})$')
|
re_cve = re.compile(r'^(\d{4})-(\d{4,5})$')
|
||||||
|
|
||||||
|
|
||||||
def cve_validator(val):
|
def cve_validator(val):
|
||||||
|
@ -69,10 +69,10 @@ def version_sort(l):
|
|||||||
generally don't have that.
|
generally don't have that.
|
||||||
"""
|
"""
|
||||||
mkey = l['link']
|
mkey = l['link']
|
||||||
m = re.match('v?([0-9]+)\.([0-9]+)\.([0-9]+)$', l['url'])
|
m = re.match(r'v?([0-9]+)\.([0-9]+)\.([0-9]+)$', l['url'])
|
||||||
if m:
|
if m:
|
||||||
mkey = m.group(1) + '%02d' % int(m.group(2)) + '%02d' % int(m.group(3))
|
mkey = m.group(1) + '%02d' % int(m.group(2)) + '%02d' % int(m.group(3))
|
||||||
m = re.match('v?([0-9]+)\.([0-9]+)$', l['url'])
|
m = re.match(r'v?([0-9]+)\.([0-9]+)$', l['url'])
|
||||||
if m:
|
if m:
|
||||||
mkey = m.group(1) + '%02d' % int(m.group(2))
|
mkey = m.group(1) + '%02d' % int(m.group(2))
|
||||||
# SOOO ugly. But if it's v10 and up, just prefix it to get it higher
|
# SOOO ugly. But if it's v10 and up, just prefix it to get it higher
|
||||||
|
@ -23,7 +23,7 @@ pagecount = 0
|
|||||||
quiet = False
|
quiet = False
|
||||||
# regular expression used to search and extract the title on a given piece of
|
# regular expression used to search and extract the title on a given piece of
|
||||||
# documentation, for further use in the application
|
# documentation, for further use in the application
|
||||||
re_titlematch = re.compile('<title\s*>([^<]+)</title\s*>', re.IGNORECASE)
|
re_titlematch = re.compile(r'<title\s*>([^<]+)</title\s*>', re.IGNORECASE)
|
||||||
# regular expression used to find any images that are in the HTML and apply
|
# regular expression used to find any images that are in the HTML and apply
|
||||||
# additional bootstrap classes
|
# additional bootstrap classes
|
||||||
re_figure_match = re.compile('<div([^<>]+)class="figure"', re.IGNORECASE)
|
re_figure_match = re.compile('<div([^<>]+)class="figure"', re.IGNORECASE)
|
||||||
|
@ -8,7 +8,7 @@ import requests
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
re_platformdir = re.compile('^(\w+)-(\d+)-([^-]+)$')
|
re_platformdir = re.compile(r'^(\w+)-(\d+)-([^-]+)$')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Spider repo RPMs")
|
parser = argparse.ArgumentParser(description="Spider repo RPMs")
|
||||||
|
@ -61,7 +61,7 @@ if __name__ == "__main__":
|
|||||||
print("Warnings: %s" % resp.headers['x-w3c-validator-warnings'])
|
print("Warnings: %s" % resp.headers['x-w3c-validator-warnings'])
|
||||||
hp = html.parser.HTMLParser()
|
hp = html.parser.HTMLParser()
|
||||||
for m in re.findall('<li class="msg_err">.*?</li>', resp.text, re.DOTALL):
|
for m in re.findall('<li class="msg_err">.*?</li>', resp.text, re.DOTALL):
|
||||||
r = re.search('<em>Line <a href="[^"]+">(\d+)</a>.*<span class="msg">(.*?)</span>', m, re.DOTALL)
|
r = re.search(r'<em>Line <a href="[^"]+">(\d+)</a>.*<span class="msg">(.*?)</span>', m, re.DOTALL)
|
||||||
if r:
|
if r:
|
||||||
print("Line %s (should be around %s): %s" % (r.group(1), int(r.group(1)) - firstline, hp.unescape(r.group(2))))
|
print("Line %s (should be around %s): %s" % (r.group(1), int(r.group(1)) - firstline, hp.unescape(r.group(2))))
|
||||||
r2 = re.search('<code class="input">(.*?)<strong title=".*?">(.*?)</strong>(.*?)</code>', m, re.DOTALL)
|
r2 = re.search('<code class="input">(.*?)<strong title=".*?">(.*?)</strong>(.*?)</code>', m, re.DOTALL)
|
||||||
|
Reference in New Issue
Block a user