diff --git a/README.md b/README.md index 0936f69..fa08eeb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Also neat: You can use your **custom artist or track images**. ## Requirements * Python 3.5 or higher -* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/). These are free of charge! +* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/) (you need a project key, not a personal one). These are free of charge! ## How to install diff --git a/maloja/globalconf.py b/maloja/globalconf.py index 8281f62..6389091 100644 --- a/maloja/globalconf.py +++ b/maloja/globalconf.py @@ -23,6 +23,9 @@ def datadir(*args): from doreah import config config( + pyhp={ + "version": 2 + }, logging={ "logfolder": datadir("logs") }, diff --git a/maloja/server.py b/maloja/server.py index ccd7b90..b8e4c19 100755 --- a/maloja/server.py +++ b/maloja/server.py @@ -187,28 +187,29 @@ def static_html(name): # if a pyhp file exists, use this if (pyhp_file and pyhp_pref) or (pyhp_file and not html_file): - environ = {} #things we expose to the pyhp pages - environ["adminmode"] = adminmode - if adminmode: environ["apikey"] = request.cookies.get("apikey") - - # maloja - environ["db"] = database - environ["htmlmodules"] = htmlmodules - environ["htmlgenerators"] = htmlgenerators - environ["malojatime"] = malojatime - environ["utilities"] = utilities - environ["urihandler"] = urihandler - environ["settings"] = settings.get_settings - # external - environ["urllib"] = urllib + #things we expose to the pyhp pages + environ = { + "adminmode":adminmode, + "apikey":request.cookies.get("apikey") if adminmode else None, + # maloja + "db": database, + "htmlmodules": htmlmodules, + "htmlgenerators": htmlgenerators, + "malojatime": malojatime, + "utilities": utilities, + "urihandler": urihandler, + "settings": settings.get_settings, + # external + "urllib": urllib + } # request environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys) environ["_urikeys"] = keys #temporary! #response.set_header("Content-Type","application/xhtml+xml") res = pyhpfile(pthjoin(WEBFOLDER,name + ".pyhp"),environ) - log("Generated page " + name + " in " + str(clock.stop()) + "s (PYHP)",module="debug") + log("Generated page {name} in {time}s (PYHP)".format(name=name,time=clock.stop()),module="debug") return res # if not, use the old way