[Webkit-unassigned] [Bug 221720] [LayoutTests] Convert http/tests/storageAccess convert PHP to Python
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Feb 11 09:28:23 PST 2021
https://bugs.webkit.org/show_bug.cgi?id=221720
--- Comment #3 from Jonathan Bedard <jbedard at apple.com> ---
Comment on attachment 419932
--> https://bugs.webkit.org/attachment.cgi?id=419932
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=419932&action=review
> LayoutTests/http/tests/storageAccess/resources/echo-incoming-cookies-as-json.py:8
> +if 'HTTP_COOKIE' in os.environ:
I would do this instead:
header_cookies = os.environ.get('HTTP_COOKIE')
header_cookies = header_cookies.split('; ') if header_cookies else []
then you can take all of this out of the if statement
> LayoutTests/http/tests/storageAccess/resources/get-cookies.py:31
> +if not cname1:
Readability suggestion here: If you made the default for name1 the empty string (like it is now), but the defaults of name2 and name3 None, you could unify this code into a single loop:
for name in [
query.get('name1', [''])[0],
query.get('name2', [None])[0],
query.get('name3', [None])[0],
]:
if name is not None:
continue
cookie = cookies.get(name)
if cookie:
print(...)
else:
print(...)
> LayoutTests/http/tests/storageAccess/resources/get-cookies.py:48
> +print('<p id="output"></p>')
I think this is a good use-case for a multi-line string (ie, ''' <content> '''
> LayoutTests/http/tests/storageAccess/resources/set-cookie.py:20
> +print('<script>')
Another code case for a multi-line string.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210211/b6fe7ef5/attachment-0001.htm>
More information about the webkit-unassigned
mailing list