def run(): import sys, os host, prefix = sys.argv[1:3] if os.name == 'nt': import locale locale.setlocale(locale.LC_ALL, '') import gtk import couchdbkit from taburet import PackageManager, config import cakeplant.exp.ui s = couchdbkit.Server(host) conf = config.Configuration(s.get_or_create_db(prefix + '_config')) pm = PackageManager() pm.use('cakeplant.exp') pm.set_db(s.get_or_create_db(prefix + '_exp'), 'cakeplant.exp') pm.set_db(s.get_or_create_db(prefix + '_common'), 'cakeplant.common') pm.sync_design_documents() form = cakeplant.exp.ui.ForwarderForm(conf) form.show() gtk.main()
def run(): import sys, os host, prefix, account = sys.argv[1:4] if os.name == "nt": import locale locale.setlocale(locale.LC_ALL, "") import gtk import couchdbkit from taburet import PackageManager, config import cakeplant.bank s = couchdbkit.Server(host) db = s.get_or_create_db(prefix) conf = config.Configuration(s.get_or_create_db(prefix + "_config")) pm = PackageManager() pm.use("cakeplant.bank") pm.set_db(db, "taburet.transactions", "taburet.accounts") pm.sync_design_documents() cakeplant.bank.BankApp(conf, account) gtk.main()
def pytest_funcarg__db(request): s = TestServer() db = s.get_db('test') pm = PackageManager() pm.use('cakeplant.bank') pm.set_db(db, 'taburet.transactions', 'taburet.accounts') pm.sync_design_documents() return db
import sys, time import csv, datetime import cPickle import couchdbkit from taburet import PackageManager from taburet.doctype import get_by_type from cakeplant.exp import Consignment from cakeplant.common import Customer, Good s = couchdbkit.Server() prefix = sys.argv[1] pm = PackageManager() pm.use('cakeplant.exp') pm.set_db(s.get_or_create_db(prefix + '_exp'), 'cakeplant.exp') pm.set_db(s.get_or_create_db(prefix + '_common'), 'cakeplant.common') pm.sync_design_documents() def tounicode(string): return string.decode('utf-8') def traverse(filename): header = True for r in csv.reader(open(filename, 'rb')): if header: header = False continue yield r
#!/usr/bin/env python import sys sys.path.append('./src') from datetime import date import bank.reports.kassa import bank.reports.month from taburet import PackageManager from taburet.accounts import AccountsPlan import couchdbkit import taburet.report.excel s = couchdbkit.Server() db = s.get_or_create_db('demo') pm = PackageManager() pm.use('bank') pm.set_db(db, 'taburet.transactions', 'taburet.accounts') pm.sync_design_documents() plan = AccountsPlan() account = plan.get_by_name('51/1') report = bank.reports.kassa.do(account, date(2010, 5, 4)) #report = bank.reports.month.do(account, date(2010, 4, 4), True) taburet.report.excel.save(report, '/tmp/wow.xls')
# -*- coding: utf-8 -*- from taburet.accounts import AccountsPlan, Account from taburet import PackageManager import couchdbkit import csv, datetime import sys s = couchdbkit.Server() db = s.get_or_create_db('dalxleb') pm = PackageManager() pm.use('taburet.accounts') pm.set_db(db, 'taburet.accounts', 'taburet.transactions') pm.sync_design_documents() accounts_cache = {} plan = AccountsPlan() def get_or_create_account(name): try: return accounts_cache[name] except KeyError: pass result = plan.get_by_name(name) if result: accounts_cache[name] = result return result
#!/usr/bin/env python import gtk import couchdbkit from taburet import PackageManager, config import cakeplant.bank s = couchdbkit.Server() db = s.get_or_create_db('demo') conf = config.Configuration(s.get_or_create_db('demo_config')) pm = PackageManager() pm.use('cakeplant.bank') pm.set_db(db, 'taburet.transactions', 'taburet.accounts') pm.sync_design_documents() cakeplant.bank.BankApp(conf) gtk.main()