From 02f2d7fedf1836138a9d0f50c5450b797e750622 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 18 Feb 2013 16:25:27 +0100 Subject: [PATCH] Fixes for newer versions of tornado. --- templates/modules/ads/download-splash.html | 3 ++- templates/modules/news-item.html | 2 +- templates/modules/planet-entry.html | 2 +- templates/planet-posting.html | 2 +- templates/wishlist/modules/wish.html | 4 ++-- templates/wishlist/wish.html | 2 +- webapp/backend/memcached.py | 18 ++++++++++++------ webapp/handlers_base.py | 6 +++--- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/templates/modules/ads/download-splash.html b/templates/modules/ads/download-splash.html index ac5c7326..2caf0f2e 100644 --- a/templates/modules/ads/download-splash.html +++ b/templates/modules/ads/download-splash.html @@ -2,7 +2,8 @@
{{ _("Advertisement") }}
- {{ _("This download is sponsored by %s!") % ad.who }} + {{ _("This download is sponsored by:") }} + {% raw ad.who %}!
diff --git a/templates/modules/news-item.html b/templates/modules/news-item.html index a97410c2..9eb061e0 100644 --- a/templates/modules/news-item.html +++ b/templates/modules/news-item.html @@ -9,7 +9,7 @@ {% end %} - {{ item.text }} + {% raw item.text %}
diff --git a/templates/modules/planet-entry.html b/templates/modules/planet-entry.html index cdf56f54..6cd520f7 100644 --- a/templates/modules/planet-entry.html +++ b/templates/modules/planet-entry.html @@ -10,7 +10,7 @@ {{ entry.title }} - {{ entry.text }} + {% raw entry.text %}

{{ _("Posted by") }} {{ entry.author.cn }} diff --git a/templates/planet-posting.html b/templates/planet-posting.html index 1637ce99..4c089500 100644 --- a/templates/planet-posting.html +++ b/templates/planet-posting.html @@ -11,7 +11,7 @@

- {{ entry.text }} + {% raw entry.text %}

diff --git a/templates/wishlist/modules/wish.html b/templates/wishlist/modules/wish.html index ba3326e6..7b8d247a 100644 --- a/templates/wishlist/modules/wish.html +++ b/templates/wishlist/modules/wish.html @@ -11,7 +11,7 @@ {{ escape(wish.title) }} - {{ wish.description }} + {% raw wish.description %}


{% end %} @@ -37,7 +37,7 @@
-

{{ _("%s €") % wish.donated }}

+

{% raw _("%s €") % wish.donated %}

{{ _("donated") }}

diff --git a/templates/wishlist/wish.html b/templates/wishlist/wish.html index ee7fcc59..f075963a 100644 --- a/templates/wishlist/wish.html +++ b/templates/wishlist/wish.html @@ -9,7 +9,7 @@ {% module Wishlist([wish,], short=True) %} - {{ wish.description }} + {% raw wish.description %}
diff --git a/webapp/backend/memcached.py b/webapp/backend/memcached.py index c489d9cb..a56b80ee 100644 --- a/webapp/backend/memcached.py +++ b/webapp/backend/memcached.py @@ -14,11 +14,17 @@ class Memcached(object): self._connection = memcache.Client(hosts, debug=0) - def get(self, *args, **kwargs): - return self._connection.get(*args, **kwargs) + def get(self, key, *args, **kwargs): + key = str(key) - def set(self, *args, **kwargs): - return self._connection.set(*args, **kwargs) + return self._connection.get(key, *args, **kwargs) - def delete(self, *args, **kwargs): - return self._connection.delete(*args, **kwargs) + def set(self, key, *args, **kwargs): + key = str(key) + + return self._connection.set(key, *args, **kwargs) + + def delete(self, key, *args, **kwargs): + key = str(key) + + return self._connection.delete(key, *args, **kwargs) diff --git a/webapp/handlers_base.py b/webapp/handlers_base.py index 1dde57a3..2dce5836 100644 --- a/webapp/handlers_base.py +++ b/webapp/handlers_base.py @@ -78,16 +78,16 @@ class BaseHandler(tornado.web.RequestHandler): kwargs.update(_kwargs) return tornado.web.RequestHandler.render_string(self, *args, **kwargs) - def get_error_html(self, status_code, **kwargs): + def write_error(self, status_code, **kwargs): if status_code in (404, 500): render_args = ({ "code" : status_code, "exception" : kwargs.get("exception", None), "message" : httplib.responses[status_code], }) - return self.render_string("error-%s.html" % status_code, **render_args) + self.render("error-%s.html" % status_code, **render_args) else: - return tornado.web.RequestHandler.get_error_html(self, status_code, **kwargs) + return tornado.web.RequestHandler.write_error(self, status_code, **kwargs) def static_url(self, path, static=True): ret = tornado.web.RequestHandler.static_url(self, path) -- 2.47.3