Exemplo n.º 1
0
def set_watch(entity, set_watch=True):
    """
    Make sure that the current user watches entity, if set_watch is True. Make
    sure that the current user doesn't watch entity, if set_watch is False.
    """
    has_watch = Watch.find_by_entity(c.user, entity)
    if set_watch and has_watch is None:
        Watch.create(c.user, entity)
        meta.Session.commit()
    elif not set_watch and has_watch is not None:
        has_watch.delete()
        meta.Session.commit()
Exemplo n.º 2
0
def set_watch(entity, set_watch=True):
    """
    Make sure that the current user watches entity, if set_watch is True. Make
    sure that the current user doesn't watch entity, if set_watch is False.
    """
    has_watch = Watch.find_by_entity(c.user, entity)
    if set_watch and has_watch is None:
        Watch.create(c.user, entity)
        meta.Session.commit()
    elif not set_watch and has_watch is not None:
        has_watch.delete()
        meta.Session.commit()
Exemplo n.º 3
0
def find_watch(entity):
    return Watch.find_by_entity(c.user, entity)
Exemplo n.º 4
0
def find_watch(entity):
    return Watch.find_by_entity(c.user, entity)