mirror of
https://github.com/golang/go
synced 2024-11-25 02:07:58 -07:00
godashboard: fix utf-8 in user names
Also standardize on 'utf8' as encoding name. Apparently either is acceptable. The user, because it is a StringProperty, must be of type unicode in order to handle Unicode correctly. It must *not* have type string. The desc, because it is a BlobProperty, must be of type string in order to handle Unicode correctly. It must *not* have type unicode. Yay encoding type pedantry without static typing. R=adg, mattn.jp CC=golang-dev https://golang.org/cl/4973045
This commit is contained in:
parent
f627215bab
commit
a3bc7681b5
@ -1,5 +1,5 @@
|
|||||||
application: godashboard
|
application: godashboard
|
||||||
version: 7
|
version: 8
|
||||||
runtime: python
|
runtime: python
|
||||||
api_version: 1
|
api_version: 1
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ import const
|
|||||||
# numbers in an hg repo. When inserting a new commit, the parent commit must be
|
# numbers in an hg repo. When inserting a new commit, the parent commit must be
|
||||||
# given and this is used to generate the new commit number. In order to create
|
# given and this is used to generate the new commit number. In order to create
|
||||||
# the first Commit object, a special command (/init) is used.
|
# the first Commit object, a special command (/init) is used.
|
||||||
|
#
|
||||||
|
# N.B. user is a StringProperty, so it must be type 'unicode'.
|
||||||
|
# desc is a BlobProperty, so it must be type 'string'. [sic]
|
||||||
class Commit(db.Model):
|
class Commit(db.Model):
|
||||||
num = db.IntegerProperty() # internal, monotonic counter.
|
num = db.IntegerProperty() # internal, monotonic counter.
|
||||||
node = db.StringProperty() # Hg hash
|
node = db.StringProperty() # Hg hash
|
||||||
@ -199,7 +202,7 @@ class Init(DashboardHandler):
|
|||||||
commit.num = 0
|
commit.num = 0
|
||||||
commit.node = node
|
commit.node = node
|
||||||
commit.parentnode = ''
|
commit.parentnode = ''
|
||||||
commit.user = self.request.get('user').encode('utf8')
|
commit.user = self.request.get('user')
|
||||||
commit.date = date
|
commit.date = date
|
||||||
commit.desc = self.request.get('desc').encode('utf8')
|
commit.desc = self.request.get('desc').encode('utf8')
|
||||||
|
|
||||||
@ -233,7 +236,7 @@ class CommitHandler(DashboardHandler):
|
|||||||
|
|
||||||
node = self.request.get('node')
|
node = self.request.get('node')
|
||||||
date = parseDate(self.request.get('date'))
|
date = parseDate(self.request.get('date'))
|
||||||
user = self.request.get('user').encode('utf8')
|
user = self.request.get('user')
|
||||||
desc = self.request.get('desc').encode('utf8')
|
desc = self.request.get('desc').encode('utf8')
|
||||||
parenthash = self.request.get('parent')
|
parenthash = self.request.get('parent')
|
||||||
|
|
||||||
@ -276,7 +279,7 @@ class CommitHandler(DashboardHandler):
|
|||||||
n.parentnode = parenthash
|
n.parentnode = parenthash
|
||||||
n.user = user
|
n.user = user
|
||||||
n.date = date
|
n.date = date
|
||||||
n.desc = desc
|
n.desc = desc.encode('utf8')
|
||||||
n.put()
|
n.put()
|
||||||
db.run_in_transaction(add_commit)
|
db.run_in_transaction(add_commit)
|
||||||
n = nodeByHash(node)
|
n = nodeByHash(node)
|
||||||
@ -294,7 +297,7 @@ class Build(webapp.RequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
builder = self.request.get('builder')
|
builder = self.request.get('builder')
|
||||||
log = self.request.get('log').encode('utf-8')
|
log = self.request.get('log').encode('utf8')
|
||||||
|
|
||||||
loghash = ''
|
loghash = ''
|
||||||
if len(log) > 0:
|
if len(log) > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user