mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:09:17 +02:00
Blacked the code
This commit is contained in:
parent
b6fc0051fa
commit
62ca3bd736
279 changed files with 8861 additions and 9527 deletions
|
@ -6,10 +6,10 @@ def full_url(path):
|
|||
Given a relative path, return a full url usable for federation purpose
|
||||
"""
|
||||
root = settings.FUNKWHALE_URL
|
||||
if path.startswith('/') and root.endswith('/'):
|
||||
if path.startswith("/") and root.endswith("/"):
|
||||
return root + path[1:]
|
||||
elif not path.startswith('/') and not root.endswith('/'):
|
||||
return root + '/' + path
|
||||
elif not path.startswith("/") and not root.endswith("/"):
|
||||
return root + "/" + path
|
||||
else:
|
||||
return root + path
|
||||
|
||||
|
@ -19,17 +19,14 @@ def clean_wsgi_headers(raw_headers):
|
|||
Convert WSGI headers from CONTENT_TYPE to Content-Type notation
|
||||
"""
|
||||
cleaned = {}
|
||||
non_prefixed = [
|
||||
'content_type',
|
||||
'content_length',
|
||||
]
|
||||
non_prefixed = ["content_type", "content_length"]
|
||||
for raw_header, value in raw_headers.items():
|
||||
h = raw_header.lower()
|
||||
if not h.startswith('http_') and h not in non_prefixed:
|
||||
if not h.startswith("http_") and h not in non_prefixed:
|
||||
continue
|
||||
|
||||
words = h.replace('http_', '', 1).split('_')
|
||||
cleaned_header = '-'.join([w.capitalize() for w in words])
|
||||
words = h.replace("http_", "", 1).split("_")
|
||||
cleaned_header = "-".join([w.capitalize() for w in words])
|
||||
cleaned[cleaned_header] = value
|
||||
|
||||
return cleaned
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue