def is_owner(item, user): if isinstance(item, unicode): item = get_item(item) seller = item.seller if seller == user: return item else: return False
def add_items(request): seller, item_name, min_bid =read_request_item(request) print seller, item_name, min_bid #item = add_item(seller, item_name, min_bid) item = get_item(item_name=item_name) exec_time= datetime.now() + timedelta(hours = 1) s.addjob(function=sell_items, time= exec_time, arguments=[request, item]) return ("Added Item: {0} {1}".format(item.item_name, item.__dict__))
def add_items(request): seller, item_name, min_bid = read_request_item(request) print seller, item_name, min_bid #item = add_item(seller, item_name, min_bid) item = get_item(item_name=item_name) exec_time = datetime.now() + timedelta(hours=1) s.addjob(function=sell_items, time=exec_time, arguments=[request, item]) return ("Added Item: {0} {1}".format(item.item_name, item.__dict__))
def view_items(request): seller, item_name = read_request_item(request) item = get_item(item_name) if item: item_name, created_at, status, seller, min_bid, sold_to =values(item) message= "Item Listed: {0} \nDateCreated: {1} \nStatus: {2} \nSeller : {3} \nMinimum Bid: {4} \nSold To: {5}".format(item_name, created_at, status, seller, min_bid, sold_to) else: return messages['ITEM_NOT_PRESENT_MESSAGE'] if is_sold(item): return (message) else: NUMBER_OF_TOP_BIDS= messages['NUMBER_OF_TOP_BIDS'] top_bids= Highestbid(N=NUMBER_OF_TOP_BIDS, item=item) message = message + "\nThe top {0} bids:\n{1}".format(NUMBER_OF_TOP_BIDS, top_bids) return (message)
def view_items(request): seller, item_name = read_request_item(request) item = get_item(item_name) if item: item_name, created_at, status, seller, min_bid, sold_to = values(item) message = "Item Listed: {0} \nDateCreated: {1} \nStatus: {2} \nSeller : {3} \nMinimum Bid: {4} \nSold To: {5}".format( item_name, created_at, status, seller, min_bid, sold_to) else: return messages['ITEM_NOT_PRESENT_MESSAGE'] if is_sold(item): return (message) else: NUMBER_OF_TOP_BIDS = messages['NUMBER_OF_TOP_BIDS'] top_bids = Highestbid(N=NUMBER_OF_TOP_BIDS, item=item) message = message + "\nThe top {0} bids:\n{1}".format( NUMBER_OF_TOP_BIDS, top_bids) return (message)