Beispiel #1
0
def get_doc(doc_path):
    ext = os.path.basename(doc_path).split('.')[-1]
    if ext and ext in app.config['DOCS_VALID_EXTS']:
        stat.update_download_count(doc_path, Utility.get_ip(request))
        return send_from_directory(app.config['DOCS_FOLDER'], doc_path, as_attachment=True)
    else:
        abort(404)
Beispiel #2
0
def get_doc(doc_path):
    ext = os.path.basename(doc_path).split('.')[-1]
    if ext and ext in app.config['DOCS_VALID_EXTS']:
        stat.update_download_count(doc_path, Utility.get_ip(request))
        return send_from_directory(app.config['DOCS_FOLDER'],
                                   doc_path,
                                   as_attachment=True)
    else:
        abort(404)
Beispiel #3
0
def view_counter():
    page_id = None
    if request.method == 'POST':
        data = json.loads(request.data)
        if 'page_title' not in data:
            return jsonify(view='Invalid Parameters Passed!!')

        title = data['page_title']
        page_id = Utility.get_md5_hash_of_title(title)
        current_app.logger.debug('Page Title : {0} & Page Id: {1}'.format(title, page_id))
        remote_ip = Utility.get_ip(request)
        update_page_count(page_id, title, remote_ip)

    result = page_view_stats.get_count(page_id)
    return jsonify(views=result['count'])
Beispiel #4
0
def view_counter():
    page_id = None
    if request.method == 'POST':
        data = json.loads(request.data)
        if 'page_title' not in data:
            return jsonify(view='Invalid Parameters Passed!!')

        title = data['page_title']
        page_id = Utility.get_md5_hash_of_title(title)
        current_app.logger.debug('Page Title : {0} & Page Id: {1}'.format(
            title, page_id))
        remote_ip = Utility.get_ip(request)
        update_page_count(page_id, title, remote_ip)

    result = page_view_stats.get_count(page_id)
    return jsonify(views=result['count'])