mirror of
https://github.com/flancian/garden.git
synced 2026-08-09 07:56:19 +00:00
Add agora.log.
This commit is contained in:
@@ -4,3 +4,4 @@
|
||||
__pycache__
|
||||
venv
|
||||
tags
|
||||
agora.log
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import jsons
|
||||
from flask import Blueprint, url_for, render_template, current_app, Response, redirect, request, jsonify
|
||||
from markupsafe import escape
|
||||
@@ -26,6 +27,12 @@ from . import util
|
||||
bp = Blueprint('agora', __name__)
|
||||
G = db.G
|
||||
|
||||
logging.basicConfig(
|
||||
filename='agora.log',
|
||||
level=logging.DEBUG,
|
||||
format='%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s'
|
||||
)
|
||||
|
||||
# Special
|
||||
@bp.route('/index')
|
||||
@bp.route('/')
|
||||
|
||||
@@ -17,6 +17,7 @@ import glob
|
||||
import itertools
|
||||
import re
|
||||
import os
|
||||
from flask import current_app
|
||||
from . import config
|
||||
from . import feed
|
||||
from . import render
|
||||
@@ -81,6 +82,7 @@ class Graph:
|
||||
|
||||
@cachetools.func.ttl_cache(maxsize=2, ttl=20)
|
||||
def nodes(self, include_journals=True):
|
||||
current_app.logger.debug('Loading graph.')
|
||||
# returns a list of all nodes
|
||||
|
||||
# first we fetch all subnodes, put them in a dict {wikilink -> [subnode]}.
|
||||
@@ -101,6 +103,7 @@ class Graph:
|
||||
if not include_journals:
|
||||
nodes = [node for node in nodes if not util.is_journal(node.wikilink)]
|
||||
|
||||
current_app.logger.debug('Graph loaded.')
|
||||
# TODO: experiment with other ranking.
|
||||
# return sorted(nodes, key=lambda x: -x.size())
|
||||
return sorted(nodes, key=lambda x: x.wikilink.lower())
|
||||
|
||||
Reference in New Issue
Block a user