mindre endringer

This commit is contained in:
Ine Beate Larsen 2011-03-06 12:27:46 +00:00
parent 0237f58f59
commit 109762f8e6
3 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
db_url = 'sqlite:///data' db_url = 'postgres.pvv.ntnu.no://torjehoa_dibblerdummy:1234@postgres/torjehoa_dibblerdummy'
quit_allowed = True quit_allowed = True
stop_allowed = False stop_allowed = False
show_tracebacks = True show_tracebacks = True

BIN
data

Binary file not shown.

View File

@ -884,24 +884,28 @@ class AdjustStockMenu(Menu):
def _execute(self): def _execute(self):
self.print_header() self.print_header()
product = self.input_product('Product> ') product = self.input_product('Product> ')
print 'The stock of this product is: %d ' % (product.stock) print 'The stock of this product is: %d ' % (product.stock)
#print 'Write the number of products you have added to the stock' print 'Write the number of products you have added to the stock'
add_stock = self.input_int('Added stock> ', (-1000, 1000)) add_stock = self.input_int('Added stock> ', (-1000, 1000))
print 'You added %d to the stock of %s' % (add_stock,product) print 'You added %d to the stock of %s' % (add_stock,product)
product.stock += add_stock product.stock += add_stock
print 'The stock is now %d' % (product.stock)
print 'The stock is now %d' % (product.stock)
try: try:
self.session.commit() self.session.commit()
print 'Stock is now stored' print 'Stock is now stored'
self.pause()
except sqlalchemy.exc.SQLAlchemyError, e: except sqlalchemy.exc.SQLAlchemyError, e:
print 'Could not store stock: %s' % (e) print 'Could not store stock: %s' % (e)
self.pause() self.pause()
return return
print 'The stock is now %d' % (product.stock)
class AdjustCreditMenu(Menu): # reimplements ChargeMenu; these should be combined to one class AdjustCreditMenu(Menu): # reimplements ChargeMenu; these should be combined to one
def __init__(self): def __init__(self):