From d96f71924ecef65e71a5ea4de41767564b9c4af5 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Wed, 25 Jul 2012 00:16:10 -0400 Subject: [PATCH] Missed a couple params. --- static/js/potd.js | 11 ++++++----- toolserver/settings.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/static/js/potd.js b/static/js/potd.js index 0fd4786..055e917 100644 --- a/static/js/potd.js +++ b/static/js/potd.js @@ -3,12 +3,13 @@ function potd_set_background() { if (cookie) { try { data = JSON.parse(cookie); + var filename = data.filename; var url = data.url; var descurl = data.descurl; var imgwidth = data.imgwidth; var imgheight = data.imgheight; - if (url && descurl && imgwidth && imgheight) { - set_background(url, descurl, imgwidth, imgheight); + if (filename && url && descurl && imgwidth && imgheight) { + set_background(filename, url, descurl, imgwidth, imgheight); return; } } @@ -72,8 +73,8 @@ function parse_file_url(data, filename) { imgheight = r["height"]; } - set_background(url, descurl, imgwidth, imgheight); - var data = {"url": url, "descurl": descurl, "imgwidth": imgwidth, "imgheight": imgheight}; + set_background(filename, url, descurl, imgwidth, imgheight); + var data = {"filename": filename, "url": url, "descurl": descurl, "imgwidth": imgwidth, "imgheight": imgheight}; var expires = new Date(); expires.setUTCMilliseconds(0); expires.setUTCSeconds(0); @@ -83,7 +84,7 @@ function parse_file_url(data, filename) { set_cookie_with_date("EarwigBackgroundCache", JSON.stringify(data), expires); } -function set_background(url, descurl, imgwidth, imgheight) { +function set_background(filename, url, descurl, imgwidth, imgheight) { var s = get_window_size(); var winwidth = s[0]; var winheight = s[1]; diff --git a/toolserver/settings.py b/toolserver/settings.py index b42fd35..80f9f5c 100644 --- a/toolserver/settings.py +++ b/toolserver/settings.py @@ -11,9 +11,9 @@ def main(context, environ, headers): cookies = parse_cookies(context, environ) if query.action == "set": - status = _do_set(query, cookies) + status = _do_set(query, cookies, headers) elif query.action == "delete": - status = _do_delete(query, cookies) + status = _do_delete(query, cookies, headers) else: status = None @@ -21,7 +21,7 @@ def main(context, environ, headers): langs, projects = get_sites(bot) return bot, cookies, status, langs, projects -def _do_set(query, cookies): +def _do_set(query, cookies, headers): changes = set() if query.lang: key = "EarwigDefaultLang" @@ -38,7 +38,7 @@ def _do_set(query, cookies): return "Updated {0}.".format(changes) return None -def _do_delete(query, cookies): +def _do_delete(query, cookies, headers): if query.cookie in cookies: delete_cookie(headers, cookies, query.cookie.encode("utf8")) template = "Deleted cookie {0}."