aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Hitchman <hitchmanr@gmail.com>2010-12-15 12:07:30 +1100
committerAndrew Gerrand <adg@golang.org>2010-12-15 12:07:30 +1100
commit5742ded3ad6496de67a80b3745dce29cd5bd5b09 (patch)
treed680d7ef77e2c81f06e4818bf5f089a5ec1649dd
parentfec6ab97262c45797af9b645f28e64c1217a593a (diff)
downloadgo-5742ded3ad6496de67a80b3745dce29cd5bd5b09.tar.gz
go-5742ded3ad6496de67a80b3745dce29cd5bd5b09.zip
godashboard: support submitting projects with non-ascii names
Fixes #1314. R=adg, rsc CC=golang-dev https://golang.org/cl/3459043
-rw-r--r--misc/dashboard/godashboard/package.py5
-rw-r--r--misc/dashboard/godashboard/project-notify.txt2
-rw-r--r--misc/dashboard/godashboard/toutf8.py14
3 files changed, 20 insertions, 1 deletions
diff --git a/misc/dashboard/godashboard/package.py b/misc/dashboard/godashboard/package.py
index e11346102d..cf59bf3e85 100644
--- a/misc/dashboard/godashboard/package.py
+++ b/misc/dashboard/godashboard/package.py
@@ -30,6 +30,11 @@ import time
import urllib2
import sets
+# local imports
+import toutf8
+
+template.register_template_library('toutf8')
+
# Storage model for package info recorded on server.
# Just path, count, and time of last install.
class Package(db.Model):
diff --git a/misc/dashboard/godashboard/project-notify.txt b/misc/dashboard/godashboard/project-notify.txt
index 3a165908ca..f55bf6421b 100644
--- a/misc/dashboard/godashboard/project-notify.txt
+++ b/misc/dashboard/godashboard/project-notify.txt
@@ -5,5 +5,5 @@ Description: {{project.descr}}
URL: {{project.web_url}}
To edit/approve/delete:
-http://godashboard.appspot.com/project/edit?name={{project.name|urlencode}}
+http://godashboard.appspot.com/project/edit?name={{project.name|toutf8|urlencode}}
diff --git a/misc/dashboard/godashboard/toutf8.py b/misc/dashboard/godashboard/toutf8.py
new file mode 100644
index 0000000000..544c681b6a
--- /dev/null
+++ b/misc/dashboard/godashboard/toutf8.py
@@ -0,0 +1,14 @@
+# Copyright 2010 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# This is a Django custom template filter to work around the
+# fact that GAE's urlencode filter doesn't handle unicode strings.
+
+from google.appengine.ext import webapp
+
+register = webapp.template.create_template_register()
+
+@register.filter
+def toutf8(value):
+ return value.encode("utf-8")