File diff 7da9d5cfe1ec → fc2c3a6b4339
accounting/storage/sql/__init__.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import logging
 
import json
 

	
 
from flask.ext.sqlalchemy import SQLAlchemy
 

	
 
from accounting.exceptions import AccountingException
 
from accounting.storage import Storage
 
from accounting.models import Transaction, Posting, Amount
 

	
 
_log = logging.getLogger(__name__)
 
db = SQLAlchemy()
 

	
 

	
 
class SQLStorage(Storage):
 
    def __init__(self, app=None):
 

	
 
        if not app:
 
            raise Exception('Missing app keyword argument')
 

	
 
        self.app = app
 
        db.init_app(app)
 

	
 
        from .models import Transaction as SQLTransaction, \
 
            Posting as SQLPosting, Amount as SQLAmount