Browse Source

Missed a couple params.

pull/24/head
Ben Kurtovic 12 years ago
parent
commit
d96f71924e
2 changed files with 10 additions and 9 deletions
  1. +6
    -5
      static/js/potd.js
  2. +4
    -4
      toolserver/settings.py

+ 6
- 5
static/js/potd.js View File

@@ -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];


+ 4
- 4
toolserver/settings.py View File

@@ -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 <b><tt>{0}</tt></b>."


Loading…
Cancel
Save