Changeset - fc2c3a6b4339
[Not reviewed]
0 13 0
Joar Wandborg - 10 years ago 2013-12-17 14:41:30
joar@wandborg.se
[license] Added notice to all python files
13 files changed with 52 insertions and 0 deletions:
0 comments (0 inline, 0 general)
accounting/__init__.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
accounting/client.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import sys
 
import argparse
 
import json
 
import logging
 
import locale
 

	
 
from datetime import datetime
 
from decimal import Decimal
 

	
 
import requests
 

	
 
from accounting.models import Transaction, Posting, Amount
accounting/config.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import os
 

	
 
LEDGER_FILE = os.environ.get('LEDGER_FILE', None)
 
DEBUG = bool(int(os.environ.get('DEBUG', 0)))
 
PORT = int(os.environ.get('PORT', 5000))
 
HOST = os.environ.get('HOST', '127.0.0.1')
 
SQLALCHEMY_DATABASE_URI = os.environ.get(
 
    'DATABASE_URI',
 
    'sqlite:///../accounting-api.sqlite')
accounting/decorators.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
from functools import wraps
 

	
 
from flask import jsonify
 

	
 
from accounting.exceptions import AccountingException
 

	
 

	
 
def jsonify_exceptions(func):
 
    '''
 
    Wraps a Flask endpoint and catches any AccountingException-based
 
    exceptions which are returned to the client as JSON.
 
    '''
accounting/exceptions.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
class AccountingException(Exception):
 
    '''
 
    Used as a base for exceptions that are returned to the caller via the
 
    jsonify_exceptions decorator
 
    '''
 
    pass
accounting/gtkclient.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import sys
 
import logging
 
import threading
 
import pkg_resources
 

	
 
from functools import wraps
 
from datetime import datetime
 

	
 
from gi.repository import Gtk
 
from gi.repository import GLib
 
from gi.repository import GObject
 

	
accounting/models.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import uuid
 
from decimal import Decimal
 

	
 

	
 
class Transaction:
 
    def __init__(self, id=None, date=None, payee=None, postings=None,
 
                 metadata=None, _generate_id=False):
 
        self.id = id
 
        self.date = date
 
        self.payee = payee
 
        self.postings = postings
 
        self.metadata = metadata if metadata is not None else {}
accounting/storage/__init__.py
Show inline comments
 
# 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
 

	
accounting/storage/ledgercli.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import sys
 
import subprocess
 
import logging
 
import time
 

	
 
from datetime import datetime
 
from xml.etree import ElementTree
 
from contextlib import contextmanager
 

	
 
from accounting.models import Account, Transaction, Posting, Amount
 
from accounting.storage import Storage
 

	
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()
 

	
accounting/storage/sql/models.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
import json
 

	
 
from . import db
 

	
 

	
 
class Transaction(db.Model):
 
    id = db.Column(db.Integer(), primary_key=True)
 
    uuid = db.Column(db.String, unique=True, nullable=False)
 
    date = db.Column(db.DateTime)
 
    payee = db.Column(db.String())
 
    meta = db.Column(db.String())
 

	
accounting/transport.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
from datetime import datetime
 

	
 
from flask import json
 

	
 
from accounting.models import Amount, Transaction, Posting, Account
 

	
 

	
 
class AccountingEncoder(json.JSONEncoder):
 
    def default(self, o):
 
        if isinstance(o, Account):
 
            return dict(
 
                __type__=o.__class__.__name__,
accounting/web.py
Show inline comments
 
# Part of accounting-api project:
 
# https://gitorious.org/conservancy/accounting-api
 
# License: AGPLv3-or-later
 

	
 
'''
 
This module contains the high-level webservice logic such as the Flask setup
 
and the Flask endpoints.
 
'''
 
import sys
 
import logging
 
import argparse
 

	
 
from flask import Flask, jsonify, request
 
from flask.ext.sqlalchemy import SQLAlchemy
 
from flask.ext.script import Manager
 
from flask.ext.migrate import Migrate, MigrateCommand
0 comments (0 inline, 0 general)