281d6fed47
- Moved the TransactionNotFound exception to a more appropriate place. - Changed the serialization for AccountingExceptions - Override the Exception.__init__ method in AccountingException - Added __eq__ methods to accounting.models.* - Catch the TransactionNotFound exception in transaction_get and return a 404 instead. This could be improved, perhaps in the jsonify_exceptions decorator so that all endpoints that raise a TransactionNotFound exception automatically return a 404.
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
# Part of accounting-api project:
|
|
# https://gitorious.org/conservancy/accounting-api
|
|
# License: AGPLv3-or-later
|
|
|
|
from abc import ABCMeta, abstractmethod
|
|
|
|
|
|
class Storage:
|
|
'''
|
|
ABC for accounting storage
|
|
'''
|
|
__metaclass__ = ABCMeta
|
|
|
|
def __init__(self, *args, **kw):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_transactions(self, *args, **kw):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_transaction(self, *args, **kw):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_account(self, *args, **kw):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_accounts(self, *args, **kw):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def add_transaction(self, transaction):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def update_transaction(self, transaction):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def delete_transaction(self, transaction_id):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def reverse_transaction(self, transaction_id):
|
|
raise NotImplementedError
|