hash = hmac.new(utf8(secret), digestmod=hashlib.sha256)
hash.update(utf8(s))
return utf8(hash.hexdigest())
-def _unquote_or_none(s):
- """None-safe wrapper around url_unescape to handle unamteched optional
- groups correctly.
-
- Note that args are passed as bytes so the handler can decide what
- encoding to use.
- """
- if s is None:
- return s
- return escape.url_unescape(s, encoding=None, plus=False)
-
+
+
+ def is_absolute(path):
+ return any(path.startswith(x) for x in ["/", "http:", "https:"])