From 0fd8de7ad359870c08a8109936a04b980cb4c2a3 Mon Sep 17 00:00:00 2001 From: trygvrad Date: Sun, 6 Mar 2011 20:15:38 +0000 Subject: [PATCH] stuff --- data | Bin 9216 -> 13312 bytes text_based.py | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/data b/data index 85b02e3c60d80be0feed20c034f8a99658a7b126..d16a14f519044bdac4c6ec7aeae896ca999f01d3 100644 GIT binary patch literal 13312 zcmeHNU2G#q9p9O;<76Gj`F5O-+wIY#@v2$P?6+43B3ym#skvOq<%$Xqk>K^#LCEdZ36(h3gAKdx?AWvM+HXl||uiQ~hDIozMeMnU$Npk3K|1m-V>T3Xf z=XX3!(yIWy9dO3FA9tk37h?rt1>O|}Mw1!zx&+Zp3Ef10eOHEz2ZeytK~+c zd^Kn%hG|tLX%^9DSZ*{MpV}jY7=~e*?|eq4{UUTrLjOd!&>x2ei5p@CVg-(^0y4^j zuE(R`v>Ov(8ZCid+yH&g=9&1}{MasZYF73QG~-UfdGzXd-BKLp84j}yj&nG{ zV4A}WgEEKX432S_W^j~4nZXo?V+@XPILctM2h%AE6CfeIQr-mV5e85fBpHAVWD@Ky zz&k-v2qQ2}i+69<;)~>gj z)%{AR%|GFptEY6rx_Mz+-MqB1@t`V? zHOhN6_3`zsGmorqt(v$Hv|Vr2D)iSEttZq+ zOHZh)e2juzI7q-$E|&ubPcl3A+qG7k{Xr26SyNzM!~%i~5%VhLRy8z_UJM4Vv})CQ zhtFonl%PLqMgfiFK9B=ay-}@wvi*r&`nB**dB4+Sc!!O?L)b^+AdyJr6a^f7w5#lX zt8%s6uC=f8lVrs5usN{4Ugd^F?C#X5tPj!k*gki@B+zs~zIv5fe7K%W}ABW~1GIJ`ype|H}VjPcZYHLFofS%X`iJMnv6etzBu=uLp*NOJVnRN>8Dk zBN>L)gU&5zJ9}ZPbnfBJV7sh_gBR4T(%I5hY4c3!qRJLSU1jSxcn8;<4iveEx3|?* zreTo(0sM(Xf8rx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b7fb 100755 --- a/text_based.py +++ b/text_based.py @@ -6,6 +6,7 @@ from sqlalchemy.sql import func from sqlalchemy import desc import re, sys, os, traceback, signal, readline from helpers import * +import datetime exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q'] help_commands = ['help', '?'] @@ -16,6 +17,11 @@ restart_commands = ['restart'] low_credit_warning_limit = -100 +def time(): + now=datetime.datetime.now() + out=str(now.day)+'-'+str(now.month)+'-'+str(now.year) + return(out) + class ExitMenu(Exception): pass @@ -135,6 +141,7 @@ class Menu(): continue if result in context_commands: self.show_context() + print 'hei hello' continue if result in faq_commands: FAQMenu().execute() @@ -851,10 +858,15 @@ When finished, write an empty line to confirm the purchase. self.print_purchase() for t in self.purchase.transactions: print 'User %s\'s credit is now %d kr' % (t.user.name, t.user.credit) - if (t.user.credit < low_credit_warning_limit and thing.card != '42'): + if (t.user.credit < low_credit_warning_limit and t.user.card != '11122233'): print ('USER %s HAS LOWER CREDIT THAN %d, AND SHOULD CONSIDER PUTTING SOME MONEY IN THE BOX.' % (t.user.name, low_credit_warning_limit)) - self.pause() + self.pause() + #skriver til log + #print Product.price + #with open("dibbler-out.txt", "a") as f: + # f.write("purchase|"+ time() +"|"+self.purchase.entries[0].product.name+"|"+t.user.name+"|+str(Product.price)+|"+'-1'+"|\n") + return True def complete_input(self): @@ -1062,6 +1074,9 @@ def restart(): if not conf.stop_allowed: signal.signal(signal.SIGTSTP, signal.SIG_IGN) + + + main = Menu('Dibbler main menu', items=[BuyMenu(), ProductListMenu(),