biweeklybudget.utils module¶
-
class
biweeklybudget.utils.
Vault
(addr='http://127.0.0.1:8200', token_path='vault_token.txt')[source]¶ Bases:
object
Provides simpler access to Vault
-
biweeklybudget.utils.
date_suffix
(n)[source]¶ Given an integer day of month (1 <= n <= 31), return that number with the appropriate suffix (st|nd|rd|th).
From: http://stackoverflow.com/a/5891598/211734
Parameters: n (int) – Integer day of month Returns: n with the appropriate suffix Return type: str
-
biweeklybudget.utils.
decode_json_datetime
(d)[source]¶ Return a datetime.datetime for a datetime that was serialized with
MagicJSONEncoder
.Parameters: d (dict) – dict from deserialized JSON Returns: datetime represented by dict Return type: datetime.datetime
-
biweeklybudget.utils.
dtnow
()[source]¶ Return the current datetime as a timezone-aware DateTime object in UTC.
Returns: current datetime Return type: datetime.datetime
-
biweeklybudget.utils.
fix_werkzeug_logger
()[source]¶ Remove the werkzeug logger StreamHandler (call from
app.py
).With Werkzeug at least as of 0.12.1, werkzeug._internal._log sets up its own StreamHandler if logging isn’t already configured. Because we’re using the
flask
command line wrapper, that will ALWAYS be imported (and executed) before we can set up our own logger. As a result, to fix the duplicate log messages, we have to go back and remove that StreamHandler.