|
@ -69,10 +69,13 @@ def NeverWhere(configfile=None): |
|
|
postcontent["title"] = initial_post["title"] |
|
|
postcontent["title"] = initial_post["title"] |
|
|
return { |
|
|
return { |
|
|
"quote" : quote, |
|
|
"quote" : quote, |
|
|
|
|
|
"start" : 0, |
|
|
|
|
|
"results" : dumps([]), |
|
|
"postid" : initial_post["_id"], |
|
|
"postid" : initial_post["_id"], |
|
|
"postcontent" : postcontent, |
|
|
"postcontent" : postcontent, |
|
|
"links" : dumps([]), |
|
|
"links" : dumps([]), |
|
|
"projects" : dumps([]), |
|
|
"projects" : dumps([]), |
|
|
|
|
|
"category_filter" : dumps([]), |
|
|
"categories" : cacheit("categories", lambda : dumps(posts.categories())) |
|
|
"categories" : cacheit("categories", lambda : dumps(posts.categories())) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -142,6 +145,23 @@ def NeverWhere(configfile=None): |
|
|
postcontent=post_content) |
|
|
postcontent=post_content) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/blog/browse/<start>") |
|
|
|
|
|
def browse(start): |
|
|
|
|
|
results = posts.browse(10, start*10, categories=[], json=False) |
|
|
|
|
|
return render_template("index.html", |
|
|
|
|
|
page="browse", |
|
|
|
|
|
start=start, |
|
|
|
|
|
results=dumps(results)) |
|
|
|
|
|
|
|
|
|
|
|
@app.route("/blog/browse/<category>/<start>") |
|
|
|
|
|
def browse_categories(category, start): |
|
|
|
|
|
results = posts.browse(10, start*10, categories=[category], json=False) |
|
|
|
|
|
return render_template("index.html", |
|
|
|
|
|
page="browse", |
|
|
|
|
|
start=start, |
|
|
|
|
|
category_filter=dumps([category]), |
|
|
|
|
|
results=dumps(results)) |
|
|
|
|
|
|
|
|
@cache.cached(timeout=50) |
|
|
@cache.cached(timeout=50) |
|
|
@app.route("/blog/switchpost/<pid>/<category>") |
|
|
@app.route("/blog/switchpost/<pid>/<category>") |
|
|
def getpostid(pid, category): |
|
|
def getpostid(pid, category): |
|
@ -168,7 +188,7 @@ def NeverWhere(configfile=None): |
|
|
# get the first post of a given category |
|
|
# get the first post of a given category |
|
|
@cache.cached(timeout=50) |
|
|
@cache.cached(timeout=50) |
|
|
@app.route("/blog/getpost/<category>") |
|
|
@app.route("/blog/getpost/<category>") |
|
|
def getbycategory(category): |
|
|
def bycategory(category): |
|
|
return posts.getbycategory(category) |
|
|
return posts.getbycategory(category) |
|
|
|
|
|
|
|
|
# get the id of every post |
|
|
# get the id of every post |
|
@ -226,12 +246,12 @@ def NeverWhere(configfile=None): |
|
|
def projects(): |
|
|
def projects(): |
|
|
return jsonify(loads(cacheit("projects", getProjects))) |
|
|
return jsonify(loads(cacheit("projects", getProjects))) |
|
|
|
|
|
|
|
|
@app.route("/blog/browse/<start>") |
|
|
@app.route("/blog/getbrowse/<start>") |
|
|
def browse(start): |
|
|
def getbrowse(start): |
|
|
return posts.browse(10, start*10, categories=[]) |
|
|
return posts.browse(10, start*10, categories=[]) |
|
|
|
|
|
|
|
|
@app.route("/blog/browse/<category>/<start>") |
|
|
@app.route("/blog/getbrowse/<category>/<start>") |
|
|
def bycategory(category, start): |
|
|
def getbycategory(category, start): |
|
|
return posts.browse(10, start*10, categories=[category]) |
|
|
return posts.browse(10, start*10, categories=[category]) |
|
|
|
|
|
|
|
|
return app |
|
|
return app |
|
|