Esempio n. 1
0
 def on_lent(book):
     mail.send_mail(
                  sender=AppUser.me().email(),
                  to=book.borrower.email(),
                  cc=(WTMB_SENDER, AppUser.me().email()),
                  subject='[whotookmybook] %s' % book.title,
                  body="%s has lent this book to %s" % (book.owner.display_name(), book.borrower.display_name()))
     from bookcache import CachedBook, CacheBookIdsBorrowed
     book_key_str = str(book.key())
     CacheBookIdsBorrowed.add_book(str(book.borrower.key()), book_key_str)
     CachedBook.reset(book_key_str)
Esempio n. 2
0
 def on_borrow(book):
     mail.send_mail(
              sender=AppUser.me().email(),
              to=book.owner.email(),
              cc=(WTMB_SENDER, AppUser.me().email()),
              subject='[whotookmybook] %s' % book.title,
              body=textwrap.dedent("""Hi %s\n
                                     %s has requested or borrowed this book from you.\n
                                     p.s.email sent by http://whotookmybook.appspot.com"""
                                     % (book.owner.display_name(), book.borrower.display_name())))
     from bookcache import CachedBook, CacheBookIdsBorrowed
     book_key_str = str(book.key())
     CacheBookIdsBorrowed.add_book(str(book.borrower.key()), book_key_str)
     CachedBook.reset(book_key_str)