def count_tag_route(url): """ Return svg of count and add 1 to url """ valid_cookie = utils.check_valid_cookie(request, url) connection = db_connection.get_connection() if not valid_cookie: db_connection.add_view(connection, url) count = db_connection.get_count(connection, url) return make_svg_response(count, url, not valid_cookie)
def count_raw_route(url): """ Return the count for a url and add 1 to it """ # Get/generate cookie, cleanup views, add a view, get the count and commit changes valid_cookie = utils.check_valid_cookie(request, url) connection = db_connection.get_connection() if not valid_cookie: db_connection.add_view(connection, url) count = db_connection.get_count(connection, url) return make_text_response(count, url, not valid_cookie)