def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss'] enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % ( enter_name, selected_time) # TODO: save the selected time as the current time in the database3 t = sqlitedb.transaction() try: sqlitedb.updateTime('update CurrentTime set Time = $time', {'time': selected_time}) except Exception as e: message = "you are not allowed to select time previous!" return render_template('select_time.html', message=message) else: t.commit() #sqlitedb.updateTime(selected_time) # Here, we assign `update_message' to `message', which means # we'll refer to it in our template as `message' return render_template('select_time.html', message=update_message)
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss'] enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % ( enter_name, selected_time) sqlitedb.updateTime(selected_time) return render_template('select_time.html', message=update_message)
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss'] enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % ( enter_name, selected_time) # TODO: save the selected time as the current time in the database sqlitedb.updateTime(selected_time) # Here, we assign `update_message' to `message', which means # we'll refer to it in our template as `message' return render_template('select_time.html', message=update_message)
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss']; enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % (enter_name, selected_time) # save the selected time as the current time in the database sqlitedb.updateTime(selected_time) # Here, we assign `update_message' to `message', which means # we'll refer to it in our template as `message' return render_template('select_time.html', message = update_message, username = session.get('username', None))
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss']; enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % (enter_name, selected_time) try: sqlitedb.updateTime(selected_time) except: update_message = 'ERROR: Time was not adjusted. Remember you cannot go back in time...duh!' # Here, we assign `update_message' to `message', which means # we'll refer to it in our template as `message' return self.render_template('select_time.html', message = update_message)
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss'] enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Hello, %s. Previously selected time was: %s.)' % (enter_name, selected_time) # TODO: save the selected time as the current time in the database flag = sqlitedb.updateTime(selected_time) if flag == 0: error_message = 'All new bids must be placed at the time which matches the current time of your AuctionBase system.' return render_template('select_time.html', message = error_message) # Here, we assign `update_message' to `message', which means # we'll refer to it in our template as `message' else: return render_template('select_time.html', message = update_message)
def POST(self): post_params = web.input() MM = post_params['MM'] dd = post_params['dd'] yyyy = post_params['yyyy'] HH = post_params['HH'] mm = post_params['mm'] ss = post_params['ss']; enter_name = post_params['entername'] selected_time = '%s-%s-%s %s:%s:%s' % (yyyy, MM, dd, HH, mm, ss) update_message = '(Time updated to: %s.)' % (selected_time) t = sqlitedb.transaction() try: result = sqlitedb.updateTime(selected_time) except Exception as e: t.rollback() update_message = str(e) else: t.commit() return render_template('select_time.html', message = update_message)
def POST(self): #transaction and test t = sqlitedb.transaction() try: post_params = web.input() item_id = int(post_params['itemID']) user_id = post_params['userID'] price = float(post_params['price']) current_time = sqlitedb.getTime() started = sqlitedb.query( "select Started from Items where ItemID = $item_id", {'item_id': item_id}) ends = sqlitedb.query( "select Ends from Items where ItemID = $item_id", {'item_id': item_id}) buyPrice = sqlitedb.query( "select Buy_Price from Items where ItemID = $item_id", {'item_id': item_id})[0].Buy_Price #current_price = sqlitedb.query("select Currently from Items where ItemID = $item_id", {'item_id': item_id})[0].Currently if (buyPrice != None): closed = sqlitedb.query( "select * from Bids where (ItemID = $item_id) and (Amount >= $buyPrice)", { 'item_id': item_id, 'buyPrice': buyPrice }) else: closed = None if (closed is None): #add bid to the database sqlitedb.updateTime( "insert into Bids values ($item_id, $user_id, $price, $currTime)", { 'item_id': item_id, 'user_id': user_id, 'price': price, 'currTime': current_time }) sqlitedb.updateTime( "update Items set Currently = $currently where ItemID = $item_id", { 'currently': price, 'item_id': item_id }) add_result = "done" update_message = 'Hello, %s. Previously added a bid for %d. of price $%d.' % ( user_id, item_id, price) else: update_message = "Failed. Try again." add_result = "" except Exception as e: t.rollback() print str(e) add_result = "" update_message = "Failed. Try again." else: t.commit() return render_template('add_bid.html', message=update_message, add_result=add_result)