Example #1
0
def filter_search(search_terms):
    """
    Subscribe to the search filter with the given terms.
    :param: search_terms -- the search to be filtered.
    :return: the search as a dictionary
    """

    search = Search.find_or_create(session, search_terms)
    SearchFilter.find_or_create(session, flask.g.user, search)

    return json_result(search.as_dictionary())
Example #2
0
def filter_search(search_terms):
    """
    Subscribe to the search filter with the given terms.
    :param: search_terms -- the search to be filtered.
    :return: the search as a dictionary
    """

    search = Search.find_or_create(session, search_terms)
    SearchFilter.find_or_create(session, flask.g.user, search)

    return json_result(search.as_dictionary())
Example #3
0
def subscribe_to_search(search_terms):
    """
    :param: search_terms -- the search terms to be subscribed to.
    Subscribe to a search with given search terms.

    :return: it returns the search as a dictionary. Like:
                id = unique id of the search;
                search_keywords = <unicode string>
             This is used to display it in the UI.

    """
    search = Search.find_or_create(session, search_terms)
    SearchSubscription.find_or_create(session, flask.g.user, search)

    return json_result(search.as_dictionary())
Example #4
0
def subscribe_to_search(search_terms):
    """
    :param: search_terms -- the search terms to be subscribed to.
    Subscribe to a search with given search terms.

    :return: it returns the search as a dictionary. Like:
                id = unique id of the search;
                search_keywords = <unicode string>
             This is used to display it in the UI.

    """
    search = Search.find_or_create(session, search_terms)
    SearchSubscription.find_or_create(session, flask.g.user, search)

    return json_result(search.as_dictionary())
Example #5
0
def unfilter_search():
    """
    A user can unsubscribe from the search with a given ID
    :return: OK / ERROR
    """

    search_id = int(request.form.get('search_id', ''))

    try:
        to_delete = SearchFilter.with_search_id(search_id, flask.g.user)
        session.delete(to_delete)
        to_delete = Search.find_by_id(search_id)
        session.delete(to_delete)
        session.commit()

    except Exception as e:
        zeeguu_core.log(str(e))
        return "OOPS. SEARCH AIN'T THERE IT SEEMS (" + str(e) + ")"

    return "OK"
Example #6
0
def unfilter_search():
    """
    A user can unsubscribe from the search with a given ID
    :return: OK / ERROR
    """

    search_id = int(request.form.get('search_id', ''))

    try:
        to_delete = SearchFilter.with_search_id(search_id, flask.g.user)
        session.delete(to_delete)
        to_delete = Search.find_by_id(search_id)
        session.delete(to_delete)
        session.commit()

    except Exception as e:
        zeeguu_core.log(str(e))
        return "OOPS. SEARCH AIN'T THERE IT SEEMS (" + str(e) + ")"

    return "OK"
Example #7
0
def unsubscribe_from_search():
    """
    A user can unsubscribe from the search with a given ID

    :return: OK / ERROR
    """

    search_id = int(request.form.get("search_id", ""))

    try:
        to_delete = SearchSubscription.with_search_id(search_id, flask.g.user)
        session.delete(to_delete)
        to_delete2 = Search.find_by_id(search_id)
        session.delete(to_delete2)
        session.commit()

    except Exception as e:
        from sentry_sdk import capture_exception

        capture_exception(e)
        zeeguu_core.log(str(e))
        return "OOPS. SEARCH AIN'T THERE IT SEEMS (" + str(e) + ")"

    return "OK"