Esempio n. 1
0
def get_default_store():
    """This function returns the default/primary store.
    Notice that this store is considered read-only inside Stoqlib
    applications. Only transactions can modify objects and should be
    created using new_store().
    This store should not be closed, it will only close when we the
    application is shutdown.

    :returns: default store
    """
    if _default_store is None:
        set_default_store(db_settings.create_store())
        # We intentionally leave this open, it's the default
        # store and should only be closed when we close the
        # application
    return _default_store
Esempio n. 2
0
def get_default_store():
    """This function returns the default/primary store.
    Notice that this store is considered read-only inside Stoqlib
    applications. Only transactions can modify objects and should be
    created using new_store().
    This store should not be closed, it will only close when we the
    application is shutdown.

    :returns: default store
    """
    if _default_store is None:
        set_default_store(db_settings.create_store())
        # We intentionally leave this open, it's the default
        # store and should only be closed when we close the
        # application
    return _default_store