utils

gratipay.utils.get_participant(state, restrict=True, resolve_unclaimed=True)[source]

Given a Request, raise Response or return Participant.

If restrict is True then we’ll restrict access to owners and admins.

gratipay.utils.get_team(state)[source]

Given a Request, raise Response or return Team.

gratipay.utils.encode_for_querystring(s)[source]

Given a unicode, return a unicode that’s safe for transport across a querystring.

gratipay.utils.decode_from_querystring(s, **kw)[source]

Given a unicode computed by encode_for_querystring, return the inverse.

We raise Response(400) if the input value can’t be decoded (i.e., it’s not ASCII, not padded properly, or not decodable as UTF-8 once Base64-decoded).

gratipay.utils.log_cursor(f)[source]

Prints sql and params to stdout. Works globaly so watch for threaded use.

gratipay.utils.to_javascript(obj)[source]

For when you want to inject an object into a <script> tag.