You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a growing list of Pando monkey patches in Liberapay that should be moved upstream if possible.
Request.source: an IP address that can be used in rate limiting, requires a new website.trusted_proxies attribute as well as the ipaddress package for python < 3.3
Response.encode_url(url): static method used by Response.redirect(), doesn't have to be part of a class once moved upstream
Response.error(code, msg=''): modifies the response and raises it
Response.success(code=200, msg=''): same as above except that code defaults to 200
Response.json(obj, code=200): same as above except that obj is serialized to JSON and the Content-Type header is set to application/json
Response.redirect(url, code=302, trusted_url=True): raises the response after modifying its code, setting the Location header, and sanitizing the URL if trusted_url is set to False
Response.render(path, state, **extra): renders the resource path (e.g. templates/confirm.spt) with state plus extra as context, sort of an internal redirect
I have a growing list of Pando monkey patches in Liberapay that should be moved upstream if possible.
Request.source
: an IP address that can be used in rate limiting, requires a newwebsite.trusted_proxies
attribute as well as theipaddress
package for python < 3.3Response.encode_url(url)
: static method used byResponse.redirect()
, doesn't have to be part of a class once moved upstreamResponse.error(code, msg='')
: modifies the response and raises itResponse.success(code=200, msg='')
: same as above except thatcode
defaults to 200Response.json(obj, code=200)
: same as above except thatobj
is serialized to JSON and theContent-Type
header is set toapplication/json
Response.sanitize_untrusted_url(url)
: prevents XSS attacksResponse.redirect(url, code=302, trusted_url=True)
: raises the response after modifying its code, setting theLocation
header, and sanitizing the URL iftrusted_url
is set toFalse
Response.render(path, state, **extra)
: renders the resourcepath
(e.g.templates/confirm.spt
) withstate
plusextra
as context, sort of an internal redirectResponse.set_cookie(key, value, expires=None, httponly=True, path='/')
: self-explanatoryResponse.erase_cookie(key, **kw)
: shortcut forset_cookie()
with an empty value and an expiration date in the pastResponse.text
: the decoded body of the response, useful in testsThe text was updated successfully, but these errors were encountered: