コード例 #1
0
ファイル: libraries.py プロジェクト: iefbr14/openlibrary
def setup():
    from openlibrary.core import msgbroker

    msgbroker.subscribe("loan-created", on_loan_created)
    msgbroker.subscribe("loan-completed", on_loan_completed)

    msgbroker.subscribe("loan-created", on_loan_created_statsdb)
    msgbroker.subscribe("loan-completed", on_loan_completed_statsdb)
コード例 #2
0
ファイル: libraries.py プロジェクト: ashumeow/openlibrary
def setup():
    from openlibrary.core import msgbroker

    msgbroker.subscribe("loan-created", on_loan_created)
    msgbroker.subscribe("loan-completed", on_loan_completed)

    msgbroker.subscribe("loan-created", on_loan_created_statsdb)
    msgbroker.subscribe("loan-completed", on_loan_completed_statsdb)
コード例 #3
0

def make_bookreader_auth_link(loan_key, item_id, book_path, ol_host):
    """
    Generate a link to BookReaderAuth.php that starts the BookReader with the information to initiate reading
    a borrowed book
    """

    olAuthUrl = "https://{0}/ia_auth/XXX".format(ol_host)
    access_token = make_ia_token(item_id, bookreader_auth_seconds)
    auth_url = 'https://%s/bookreader/BookReaderAuth.php?uuid=%s&token=%s&id=%s&bookPath=%s&olHost=%s&olAuthUrl=%s' % (
        bookreader_host, loan_key, access_token, item_id, book_path, ol_host,
        olAuthUrl)

    return auth_url


def on_loan_update(loan):
    # update the waiting list and ebook document.
    waitinglist.update_waitinglist(loan['ocaid'])


def on_loan_delete(loan):
    # update the waiting list and ebook document.
    waitinglist.update_waitinglist(loan['ocaid'])


msgbroker.subscribe("loan-created", on_loan_update)
msgbroker.subscribe("loan-completed", on_loan_delete)
lending.setup(config)
コード例 #4
0
ファイル: borrow.py プロジェクト: ahvigil/openlibrary
    if token_hmac == expected_hmac:
        return True
        
    return False
    
def make_bookreader_auth_link(loan_key, item_id, book_path, ol_host):
    """
    Generate a link to BookReaderAuth.php that starts the BookReader with the information to initiate reading
    a borrowed book
    """
    
    olAuthUrl = "https://{0}/ia_auth/XXX".format(ol_host)
    access_token = make_ia_token(item_id, bookreader_auth_seconds)
    auth_url = 'https://%s/bookreader/BookReaderAuth.php?uuid=%s&token=%s&id=%s&bookPath=%s&olHost=%s&olAuthUrl=%s' % (
        bookreader_host, loan_key, access_token, item_id, book_path, ol_host, olAuthUrl
    )
    
    return auth_url
    
def on_loan_update(loan):
    # update the waiting list and ebook document.
    waitinglist.update_waitinglist(loan['ocaid'])
    
def on_loan_delete(loan):
    # update the waiting list and ebook document.
    waitinglist.update_waitinglist(loan['ocaid'])

msgbroker.subscribe("loan-created", on_loan_update)
msgbroker.subscribe("loan-completed", on_loan_delete)
lending.setup(config)
コード例 #5
0
ファイル: events.py プロジェクト: kamdjouduplex/openlibrary
def setup():
    """Installs handlers for various events.
    """
    msgbroker.subscribe("page.edit.libraries", on_library_edit)
    msgbroker.subscribe("page.edit", on_page_edit)