Bugfixes with blog and photo albums

This commit is contained in:
Noah 2016-04-19 22:31:55 +00:00
parent b36e764507
commit 1d3dc51bca
2 changed files with 7 additions and 2 deletions

View File

@ -45,12 +45,14 @@ def get_index():
db = JsonDB.get("blog/index") db = JsonDB.get("blog/index")
# Hide any private posts if we aren't logged in. # Hide any private posts if we aren't logged in.
new_db = dict()
if not g.info["session"]["login"]: if not g.info["session"]["login"]:
for post_id, data in db.items(): for post_id, data in db.items():
if data["privacy"] == "private": if data["privacy"] == "private":
del db[post_id] continue
new_db[post_id] = db[post_id]
return db return new_db
def rebuild_index(): def rebuild_index():

View File

@ -43,6 +43,9 @@ def album_index(name):
g.info["album"] = name g.info["album"] = name
g.info["album_info"] = Photo.get_album(name) g.info["album_info"] = Photo.get_album(name)
if not g.info["album_info"]:
flash("That photo album wasn't found!")
return redirect(url_for(".albums"))
g.info["markdown"] = render_markdown(g.info["album_info"]["description"]) g.info["markdown"] = render_markdown(g.info["album_info"]["description"])
g.info["photos"] = photos g.info["photos"] = photos