Beispiel #1
0
def notify_followers(offer, is_auction=False):
    isbn = offer["isbn"]
    followers = get_followers(isbn)
    followers = [x + "@princeton.edu" for x in followers]

    dict = get_book_info(isbn)
    dict["is_auction"] = is_auction
    
    dict['offer'] = offer
    html_msg = render_to_string("notify_newoffer.html", dict)
   
    if is_auction:
        subject = "An Auction has started"
        text_msg = "An auction has started for %s on tex" % dict["book"]["title"]
    else:
        subject = "New Offer Available"
        text_msg = "A new offer is available for %s on tex" % dict["book"]["title"]
    
    frontcover =  dict["book"]["frontcover"]
    
    email_users(followers, html_msg, text_msg, frontcover, subject, mass=True)
    return
Beispiel #2
0
def get_book_info(isbn):
    from search.models import get_book_info
    return {"book":get_book_info(isbn = isbn, thumb=False)[0]}