Example #1
0
	def confirm(self):
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		bookcopy.update_due_date(self.due_date)
		bookcopy.put()
		self.cleanup()
		return "%s has been extended to %s" %(book.title,str(self.due_date))
Example #2
0
	def confirm(self):
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		other = UserAccount.query(UserAccount.key==bookcopy.borrower).get()
		book = Book.query(Book.key==bookcopy.book).get()
		bookcopy.return_book()
		bookcopy.put()
		self.cleanup()
		return "%s has been returned to your library" %(book.title)
Example #3
0
	def reject(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		self.cleanup()
		
		otherAction = RequestToBorrow.query(RequestToBorrow.book == bookcopy.key and RequestToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "Request cancelled"
Example #4
0
	def reject(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		self.cleanup()

		otherAction = WaitingToBorrow.query(WaitingToBorrow.book == bookcopy.key and WaitingToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "You have denied %s permission to borrow %s" %(other.name,book.title)
Example #5
0
	def confirm(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		
		due_date = None
		cur_user = UserAccount.query(UserAccount.key==self.useraccount).get()
		cur_user.lend_book(int(bookcopy.key.id()), int(other.key.id()), due_date)
		
		self.cleanup()
		
		otherAction = WaitingToBorrow.query(WaitingToBorrow.book == bookcopy.key and WaitingToBorrow.useraccount == other.key).get()
		otherAction.cleanup()
		
		return "You have agreed to lend %s to %s" %(book.title,other.name)
Example #6
0
	def text(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		return "%s has requested to borrow '%s'" %(other.name,book.title)
Example #7
0
	def text(self):
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		other = UserAccount.query(UserAccount.key==bookcopy.borrower).get()
		book = Book.query(Book.key==bookcopy.book).get()
		return "%s wants to extend the due date of '%s' to %s?" %(other.name,book.title,str(self.due_date))
Example #8
0
	def reject(self):
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		other = UserAccount.query(UserAccount.key==bookcopy.borrower).get()
		book = Book.query(Book.key==bookcopy.book).get()
		self.cleanup()
		return "Recorded that %s didn't return %s" %(other.name,book.title)
Example #9
0
	def text(self):
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		other = UserAccount.query(UserAccount.key==bookcopy.borrower).get()
		book = Book.query(Book.key==bookcopy.book).get()
		return "%s reported checking in '%s'" %(other.name,book.title)
Example #10
0
	def confirm(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		print "You have accepted a connection request from %s" %(other.name)
Example #11
0
	def text(self):
		other = UserAccount.query(UserAccount.key==self.connection).get()
		bookcopy = BookCopy.query(BookCopy.key==self.book).get()
		book = Book.query(Book.key==bookcopy.book).get()
		return "You have requested to borrow '%s' from %s" %(book.title,other.name)