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