added a new configuration file and changed code/templates to use it
[iron-blogger] / config.py
diff --git a/config.py b/config.py
new file mode 100644 (file)
index 0000000..d112ea5
--- /dev/null
+++ b/config.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+## -*- coding: utf-8 -*-
+
+import os.path
+import datetime
+import subprocess
+
+HERE  = os.path.dirname(__file__)
+START = datetime.datetime(2011, 10, 24, 6)
+
+XMLRPC_ENDPOINT = 'http://iron-blogger.mako.cc/xmlrpc.php'
+USER            = 'mako'
+BLOG_ID         = 1
+PARTICIPANTS_PAGE_ID         = 12
+
+FINE_SIZE = 5
+CURRENCY = "$"
+
+# check the version of ledger to find out which commands to use
+if subprocess.check_output(['ledger', '--version'])[7] == 3:
+    BALANCE_CMD = ['ledger', '-f', os.path.join(HERE,'ledger'),
+                   '--no-color', '-n', 'balance']
+
+    DEBTS_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
+                 '--flat', '--no-total', '--no-color',
+                 'balance', 'Pool:Owed:']
+
+else:
+    BALANCE_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
+                   '-n', 'balance']
+    DEBTS_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
+                 '-n', 'balance', 'Pool:Owed:']
+    

Benjamin Mako Hill || Want to submit a patch?