biweeklybudget.flaskapp.views.ofx module¶
-
class
biweeklybudget.flaskapp.views.ofx.
OfxAccounts
[source]¶ Bases:
flask.views.MethodView
Handle GET /api/ofx/accounts endpoint.
This returns the JSON-ified return value from
get_accounts()
and will usually be called fromget_accounts()
.-
methods
= {'GET'}¶
-
-
class
biweeklybudget.flaskapp.views.ofx.
OfxAjax
[source]¶ Bases:
biweeklybudget.flaskapp.views.searchableajaxview.SearchableAjaxView
Handle GET /ajax/ofx endpoint.
-
_filterhack
(qs, s, args)[source]¶ DataTables 1.10.12 has built-in support for filtering based on a value in a specific column; when this is done, the filter value is set in
columns[N][search][value]
where N is the column number. However, the python datatables package used here only supports the globalsearch[value]
input, not the per-column one.However, the DataTable search is implemented by passing a callable to
table.searchable()
which takes two arguments, the current Query that’s being built, and the user’ssearch[value]
input; this must then return a Query object with the search applied.In python datatables 0.4.9, this code path is triggered on
if callable(self.search_func) and search.get("value", None):
As such, we can “trick” the table to use per-column searching (currently only if global searching is not being used) by examining the per-column search values in the request, and setting the search function to one (this method) that uses those values instead of the global
search[value]
.Parameters: Returns: Query with searching applied
Return type: sqlalchemy.orm.query.Query
-
methods
= {'GET'}¶
-
-
class
biweeklybudget.flaskapp.views.ofx.
OfxStatementPost
[source]¶ Bases:
flask.views.MethodView
Handle POST /api/ofx/statement endpoint.
This is a ReST API bridge between
update_statement_ofx()
on the client side andupdate_statement_ofx()
on the server side.-
methods
= {'POST'}¶
-
post
()[source]¶ Handle POST to /api/ofx/statement (from
update_statement_ofx()
) to upload a new OFX Statement (viaupdate_statement_ofx()
).The POSTed JSON should have the following keys:
acct_id
(int) the Account ID the Statement is formtime
(str) base64-encoded, pickled representation of the file modification time of the OFX filefilename
(str) the file name of the OFX fileofx
(str) base64-encoded, pickled representation of theofxparse.ofxparse.Ofx
instance representing the Statement
Returns a JSON object with the following fields:
success
(bool) whether the operation was successfulmessage
(str) message describing success or error message
For successful operations, the JSON object will contain the following additional fields:
count_new
(int) count of new transactions addedcount_updated
(int) count of transactions updatedstatement_id
(int) ID of the newly-added statement
HTTP Status Codes:
- 201 - Statement successfully added
- 500 - DuplicateFileException
- 400 - Any other error/exception
-
-
class
biweeklybudget.flaskapp.views.ofx.
OfxTransAjax
[source]¶ Bases:
flask.views.MethodView
Handle GET /ajax/ofx/<int:acct_id>/<str:fitid> endpoint.
-
methods
= {'GET'}¶
-