experimental-accounting-api/accounting/storage/__init__.py

54 lines
1.2 KiB
Python
Raw Normal View History

# Part of accounting-api project:
# https://gitorious.org/conservancy/accounting-api
# License: AGPLv3-or-later
2013-12-17 10:14:45 +00:00
from abc import ABCMeta, abstractmethod
from accounting.exceptions import AccountingException
2013-12-17 10:14:45 +00:00
class Storage:
'''
ABC for accounting storage
'''
2013-12-17 10:14:45 +00:00
__metaclass__ = ABCMeta
def __init__(self, *args, **kw):
2013-12-17 10:14:45 +00:00
pass
2013-12-17 10:14:45 +00:00
@abstractmethod
def get_transactions(self, *args, **kw):
2013-12-17 10:14:45 +00:00
raise NotImplementedError
2013-12-17 10:14:45 +00:00
@abstractmethod
def get_transaction(self, *args, **kw):
2013-12-17 10:14:45 +00:00
raise NotImplementedError
2013-12-17 10:14:45 +00:00
@abstractmethod
def get_account(self, *args, **kw):
2013-12-17 10:14:45 +00:00
raise NotImplementedError
2013-12-17 10:14:45 +00:00
@abstractmethod
def get_accounts(self, *args, **kw):
2013-12-17 10:14:45 +00:00
raise NotImplementedError
@abstractmethod
def add_transaction(self, transaction):
raise NotImplementedError
2013-12-17 10:14:45 +00:00
@abstractmethod
def update_transaction(self, transaction):
raise NotImplementedError
@abstractmethod
def delete_transaction(self, transaction_id):
raise NotImplementedError
2013-12-17 10:14:45 +00:00
@abstractmethod
def reverse_transaction(self, transaction_id):
raise NotImplementedError
class TransactionNotFound(AccountingException):
pass