Ejemplo n.º 1
0
	def confirm(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		
		due_date = None
		cur_user = UserAccount.query(UserAccount.key==self.useraccount).get()
		cur_user.lend_item(int(itemcopy.key.id()), int(other.key.id()), due_date)
		
		self.cleanup()
		
		otherAction = WaitingToBorrow.query(WaitingToBorrow.item == itemcopy.key and WaitingToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "You have agreed to lend %s to %s" %(item.title,other.name)
Ejemplo n.º 2
0
	def confirm(self):
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		other = UserAccount.query(UserAccount.key==itemcopy.borrower).get()
		item = Item.query(Item.key==itemcopy.item).get()
		itemcopy.return_item()
		itemcopy.put()
		self.cleanup()
		return "%s has been returned to your library" %(item.title)
Ejemplo n.º 3
0
	def reject(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		self.cleanup()
		
		otherAction = RequestToBorrow.query(RequestToBorrow.item == itemcopy.key and RequestToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "Request cancelled"
Ejemplo n.º 4
0
	def reject(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		self.cleanup()

		otherAction = WaitingToBorrow.query(WaitingToBorrow.item == itemcopy.key and WaitingToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "You have denied %s permission to borrow %s" %(other.name,item.title)
Ejemplo n.º 5
0
	def text(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		return "%s has requested to borrow '%s'" %(other.name,item.title)
Ejemplo n.º 6
0
	def reject(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		self.cleanup()
		return "You have rejected a connection request from %s" %(other.name)
Ejemplo n.º 7
0
	def confirm(self):
		invitee = UserAccount.query(UserAccount.key==self.connection).get()
		invited = UserAccount.query(UserAccount.key==self.useraccount).get()
		invited.add_connection(invitee)
		self.cleanup()
		return "You have accepted a connection request from %s" %(invitee.name)
Ejemplo n.º 8
0
	def text(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		return "%s has requested to connect" %(other.name)
Ejemplo n.º 9
0
	def text(self):
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		other = UserAccount.query(UserAccount.key==itemcopy.borrower).get()
		item = Item.query(Item.key==itemcopy.item).get()
		return "%s wants to extend the due date of '%s' to %s?" %(other.name,item.title,str(self.due_date))
Ejemplo n.º 10
0
	def reject(self):
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		other = UserAccount.query(UserAccount.key==itemcopy.borrower).get()
		item = Item.query(Item.key==itemcopy.item).get()
		self.cleanup()
		return "Recorded that %s didn't return %s" %(other.name,item.title)
Ejemplo n.º 11
0
	def text(self):
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		other = UserAccount.query(UserAccount.key==itemcopy.borrower).get()
		item = Item.query(Item.key==itemcopy.item).get()
		return "%s reported checking in '%s'" %(other.name,item.title)
Ejemplo n.º 12
0
	def confirm(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		print "You have accepted a connection request from %s" %(other.name)
Ejemplo n.º 13
0
	def text(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		itemcopy = ItemCopy.query(ItemCopy.key==self.item).get()
		item = Item.query(Item.key==itemcopy.item).get()
		return "You have requested to borrow '%s' from %s" %(item.title,other.name)