The unified diff between revisions [8e272dc5..] and [3940066f..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "Chart.py"
# from [2a7fc6c5a294cdd64c0f74924872ff378673bc01]
# to [b8b399cda94f87529fd1e8dfd3a22f316aa75b27]
#
# patch "ChartInterface.py"
# from [a648c3d362fc035a493a9e4e02a2553e009e32e7]
# to [5dca41dbe38823c2d9a7e2c396c709c7c8fb03ac]
#
# patch "SQLTemplates.py"
# from [edba5829d9ce5a6327a26c29a0cf88933f3e362c]
# to [819862410d7d14aea08e6d162e6d15c964556089]
#
# patch "Store.py"
# from [494200b4a334e8b591e31f6d511b75a5c45e4a94]
# to [362da0ea5ba5cd8d48105ca991f2f831b9f7a003]
#
============================================================
--- Chart.py 2a7fc6c5a294cdd64c0f74924872ff378673bc01
+++ Chart.py b8b399cda94f87529fd1e8dfd3a22f316aa75b27
@@ -15,6 +15,11 @@ class Chart:
self.store = system.store
def create(self, details, debitbalance, info):
+ db = self.store.db
+ cursor = db.cursor()
+
+ cursor.execute(chart_sql['newledger'],(details, debitbalance, info))
+
+ db.commit()
+
+ return cursor.lastrowid
-
- # FIXME some code should go here
- return True
============================================================
--- ChartInterface.py a648c3d362fc035a493a9e4e02a2553e009e32e7
+++ ChartInterface.py 5dca41dbe38823c2d9a7e2c396c709c7c8fb03ac
@@ -6,7 +6,7 @@ import shlex
import sys
import shlex
-import Chart
+from Chart import Chart
from CLIParser import CLIParser, CLIParserError
from States import *
@@ -77,6 +77,7 @@ class ChartInterface:
vstatus.change_state(STATE_CHART_IDLE, 1)
def create(self, state, event, params, v, vstatus):
+ vstatus.change_state(STATE_CHART_IDLE, 1)
args = shlex.split(self.input)
print args
@@ -98,26 +99,18 @@ class ChartInterface:
except CLIParserError:
print "command problem: %s" % (self.input,)
- if not options.details or \
- not options.debitbalance or \
- not options.info:
+ if options.details is None or \
+ options.debitbalance is None or \
+ options.info is None:
print "missing fields for create"
op.print_help()
+ return
c = Chart(v)
- return c.create(options.details,options.debitbalance,options.info)
+ print c.create(options.details,options.debitbalance,options.info)
- # FIXME call system to insert into table
-# return
-
-
-# if len(args) != 0:
-# op.error('extra command line arguments: ' + ' '.join(args))
-
- vstatus.change_state(STATE_CHART_IDLE, 1)
-
def details(self, state, event, params, v, vstatus):
args = self.input.split()
print "filename is %s" % (args[1],)
============================================================
--- SQLTemplates.py edba5829d9ce5a6327a26c29a0cf88933f3e362c
+++ SQLTemplates.py 819862410d7d14aea08e6d162e6d15c964556089
@@ -8,3 +8,9 @@ create_fourstar_db['LEDGER'] = "CREATE T
create_fourstar_db['CHART'] = "CREATE TABLE CHART ( accountid integer primary key autoincrement, details text, debitbalance boolean, info text)"
create_fourstar_db['JOURNAL'] = "CREATE TABLE JOURNAL ( journalid integer primary key autoincrement, date text explanation text, postref integer, accountid integer, debit float, credit float)"
create_fourstar_db['LEDGER'] = "CREATE TABLE LEDGER ( postid integer primary key autoincrement, accountid integer, date text, explanation text, journalref integer, debit float, credit float, balancedebit float, balancecredit float)"
+
+
+chart_sql = {}
+
+chart_sql['newledger'] = "INSERT INTO CHART (details, debitbalance, info) VALUES (?, ?, ?)"
+
============================================================
--- Store.py 494200b4a334e8b591e31f6d511b75a5c45e4a94
+++ Store.py 362da0ea5ba5cd8d48105ca991f2f831b9f7a003
@@ -47,6 +47,7 @@ class Store:
def check_schema(self):
for statement in create_fourstar_db.keys():
+ # FIXME move sql out
self.cursor.execute("select sql from sqlite_master where tbl_name=?;",(statement,))
sql = self.cursor.fetchone()
if not sql: