0.0 (1): SELECT en.id AS entryId, en.title AS title, en.content AS
content, en.slug AS entry_slug, en.createdTime AS createdTime,
en.commentNum AS commentNum, ca.id AS categoryId, ca.slug AS
category_slug, ca.name AS category_name FROM entries en LEFT JOIN
categories ca ON en.categoryId = ca.id WHERE en.slug = u'how-to-create-
rss-2-yourself'
0.0 (2): SELECT COUNT(id) AS num FROM comments WHERE entryId = 77
0.0 (3): SELECT * FROM entry_tag et LEFT JOIN tags t ON t.id =
et.tagId WHERE et.entryId = 77L
0.0 (4): SELECT * FROM comments WHERE entryId = 77L ORDER BY
createdTime ASC LIMIT 0, 5
Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/web/application.py", line
242, in process
return self.handle()
File "/usr/lib64/python2.6/site-packages/web/application.py", line
233, in handle
return self._delegate(fn, self.fvars, args)
File "/usr/lib64/python2.6/site-packages/web/application.py", line
412, in _delegate
return handle_class(cls)
File "/usr/lib64/python2.6/site-packages/web/application.py", line
387, in handle_class
return tocall(*args)
File "/home/icefox/Projects/davidblog/views.py", line 149, in POST
return render.entry(**d)
File "/usr/lib64/python2.6/site-packages/jinja2/environment.py",
line 669, in render
return self.environment.handle_exception(exc_info, True)
File "/home/icefox/Projects/davidblog/templates_jinja2/entry.html",
line 1, in top-level template code
{% extends "base.html" %}
File "/home/icefox/Projects/davidblog/templates_jinja2/base.html",
line 44, in top-level template code
<div id="main">{% block content %}{% endblock %}</div>
File "/home/icefox/Projects/davidblog/templates_jinja2/entry.html",
line 68, in block "content"
<td>{{ f.captcha.render() }}</td>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position
67: ordinal not in range(128)
127.0.0.1:39524 - - [24/Jan/2010 20:29:58] "HTTP/1.1 POST /entry/how-
to-create-rss-2-yourself/" - 500 Internal Server Error
On Jan 24, 4:25 pm, Anand Chitipothu <[email protected]> wrote:
> On Sat, Jan 23, 2010 at 10:37 PM, David Shieh <[email protected]> wrote:
> > Hey guys,
> > I faced a unicode problem now, in forms.py, I wrote a form like this:
> > ----------------------------------------------------------------------
> > #-*-coding=utf-8-*-
> > usernameValidator = form.regexp(r".{3,15}$", "Please input username")
> > emailValidator = form.regexp(r"....@.*", u"请输入合法的Email地址")
> > urlValidator = form.regexp(r"http://.*", u"请输入合法的URL地址")
> > commentForm = form.Form(
> > form.Textbox('name', usernameValidator),
> > form.Textbox('email', emailValidator),
> > form.Textbox('url'),
> > form.Textarea('comment', form.notnull),
> > form.Textbox('captcha', captchaValidator,
> > description="Captcha Code"),
> > )
> > ----------------------------------------------------------------------
> > The charactors in Validadors are Chinese, and I used form in template
> > jinja2 by using
> > {{ f.email.render() }}.
> > The problem happened when I submit empty form, and I've got an error
> > like this:
> > <type 'exceptions.UnicodeDecodeError'> at /entry/how-to-create-rss-2-
> > yourself/
> > ('ascii', '<input type="text" name="email" id="email" /><strong
> > class="wrong">\xe8\xaf\xb7\xe8\xbe
> > \x93\xe5\x85\xa5\xe5\x90\x88\xe6\xb3\x95\xe7\x9a\x84Email\xe5\x9c
> > \xb0\xe5\x9d\x80</strong>', 67, 68, 'ordinal not in range(128)')
>
> > I know it's charset's problem, and question is, how can I fix it, I
> > even tried to encode and decode the error message, but it didn't help.
> > Guys, please help me with this, thanks !
>
> Can you share the traceback of the exception?
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.