Skip to content

Commit cd36080

Browse files
committed
play with caching
1 parent 1c9aa5f commit cd36080

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyhackers/controllers/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ def user_profile(nick):
287287
os_projects=os_projects)
288288

289289

290-
@cache.cached(timeout=10000)
290+
@cache.cached(timeout=10000, unless=request_force_non_cache)
291+
def find_tutorial(slug):
292+
return Tutorial.query.filter_by(slug=slug).first()
293+
291294
@main_app.route('/tutorial/<regex(".+"):nick>/<regex(".+"):tutorial>')
292295
def tutorial(nick, tutorial):
293-
slug = "{}/{}".format(nick,tutorial)
294-
tutorial_obj = Tutorial.query.filter_by(slug=slug).first()
295-
296-
return render_base_template("tutorial.html", tutorial=tutorial_obj)
296+
return render_template("tutorial.html", tutorial=find_tutorial("{}/{}".format(nick, tutorial)))
297297

298298
@main_app.route("/authenticate")
299299
def authenticate():

0 commit comments

Comments
 (0)