# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals

session_data = None

def set_session_data(sd):
    nonlocal session_data
    session_data = sd
    return session_data

def get_session_data():
    return session_data

def main_js(newval):
    if newval is not undefined:
        main_js.ans = newval
    return main_js.ans

def get_current_query(newval):
    if newval:
        get_current_query.ans = newval
    return get_current_query.ans


def get_db(db):
    if db:
        get_db.db = db
    return get_db.db


def get_translations(val):
    if val:
        get_translations.ans = val
    return get_translations.ans


def book_whose_metadata_is_being_edited(set_book_id=''):
    if jstype(set_book_id) is 'number':
        book_whose_metadata_is_being_edited.ans = set_book_id
    elif set_book_id is None:
        book_whose_metadata_is_being_edited.ans = None
    return book_whose_metadata_is_being_edited.ans
