How to use the arxiv.base.globals.get_application_global function in arxiv

To help you get started, we’ve selected a few arxiv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arXiv / arxiv-browse / browse / services / document / metadata.py View on Github external
def current_session() -> AbsMetaSession:
    """Get/create :class:`.AbsMetaSession` for this context."""
    g = get_application_global()
    if not g:
        return get_session()
    if 'abs_meta' not in g:
        g.abs_meta = get_session()
    assert isinstance(g.abs_meta, AbsMetaSession)
    return g.abs_meta
github arXiv / arxiv-browse / browse / services / document / cache.py View on Github external
def current_session() -> DocumentCacheSession:
    """Get/create :class:`.DocumentCacheSession` for this context."""
    g = get_application_global()
    if not g:
        return get_session()
    if 'doc_cache' not in g:
        g.doc_cache = get_session()
    assert isinstance(g.doc_cache, DocumentCacheSession)
    return g.doc_cache