summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-21 02:12:04 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-21 02:12:04 -0500
commit635660579cde7f02dc72d095b0661da567bb201d (patch)
tree256d895738c296bc1c8e1ee119b1aecbeb913483 /python
parent9e01d3948c5d91b6e921d0f412122536a30d3cdd (diff)
downloadfork-ledger-635660579cde7f02dc72d095b0661da567bb201d.tar.gz
fork-ledger-635660579cde7f02dc72d095b0661da567bb201d.tar.bz2
fork-ledger-635660579cde7f02dc72d095b0661da567bb201d.zip
server.py now wants a query string
Diffstat (limited to 'python')
-rw-r--r--python/server.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/python/server.py b/python/server.py
index 8ce99912..541f4541 100644
--- a/python/server.py
+++ b/python/server.py
@@ -70,20 +70,18 @@ templateDef = '''#encoding utf-8
</tr>
</tfoot>
<tbody>
- #for $xact in $journal
- #for $post in $xact
+ #for $post in $posts
#set $total = $total + $post.amount
<tr>
- <!--<td>${$xact.date if $xact is not $last_xact else $empty}</td>
- <td>${$xact.payee if $xact is not $last_xact else $empty}</td>-->
- <td>$xact.date</td>
- <td>$xact.payee</td>
+ <!--<td>${$post.xact.date if $post.xact is not $last_xact else $empty}</td>
+ <td>${$post.xact.payee if $post.xact is not $last_xact else $empty}</td>-->
+ <td>$post.xact.date</td>
+ <td>$post.xact.payee</td>
<td>$post.account</td>
<td>${strip($post.amount)}</td>
<td>${strip($total)}</td>
</tr>
- #set $last_xact = $xact
- #end for
+ #set $last_xact = $post.xact
#end for
</tbody>
</table>
@@ -120,7 +118,7 @@ class LedgerHandler(BaseHTTPRequestHandler):
tmpl = Template(templateDef, filter=UnicodeFilter)
tmpl.title = 'Ledger Journal'
- tmpl.journal = self.journal
+ tmpl.posts = self.journal.collect(sys.argv[2])
tmpl.total = ledger.Value(0)
tmpl.strip = strip
tmpl.last_xact = None
@@ -192,7 +190,7 @@ def main(*args):
server.socket.close()
if __name__ == '__main__':
- if len(sys.argv) < 2:
- print "usage: server.py <DATA-FILE>"
+ if len(sys.argv) < 3:
+ print "usage: server.py <DATA-FILE> <REPORT-QUERY>"
sys.exit(1)
main()