i use TG2 and repoze.who, sqlalchemy

in my application, User.display_name is Chinese name.
but login_handler will report the following exceptions:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 50-51:
> ordinal not in range(128)

View as:   
Interactive<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
|
Text <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#> |
XML <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
(full) <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

 clear this
clear this

URL: http://192.168.1.111:8080/post_login?came_from=%2Fhome

Module weberror.evalexception:431 in respond
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
try:
                   __traceback_supplement__ = errormiddleware.Supplement,
self, environ
                   app_iter = self.application(environ,
detect_start_response)

                   # Don't create a list from a paste.fileapp object

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
app_iter = self.application(environ, detect_start_response)

 Module tg.configuration:643 in wrapper
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
log.debug("Making request body seekable")
                   Request(environ).make_body_seekable()
               return app(environ, start_response)
           return wrapper

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
return app(environ, start_response)

 Module tg.configuration:543 in remover
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
def remover(environ, start_response):
                   try:
                       return app(environ, start_response)
                   finally:
                       log.debug("Removing DBSession from current thread")

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
return app(environ, start_response)

 Module repoze.tm:19 in __call__
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
return start_response(status, headers, exc_info)
               try:
                   result = self.application(environ,
save_status_and_headers)
               except:
                   self.abort()

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
result = self.application(environ, save_status_and_headers)

 Module repoze.who.middleware:107 in __call__
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
wrapper = StartResponseWrapper(start_response)
               app_iter = app(environ, wrapper.wrap_start_response)

               if self.challenge_decider(environ, wrapper.status, wrapper.
headers):

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
app_iter = app(environ, wrapper.wrap_start_response)

 Module tw.core.middleware:36 in __call__
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
def __call__(self, environ, start_response):
               return self.wsgi_app(environ, start_response)

           def wsgi_app(self, environ, start_response):

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
return self.wsgi_app(environ, start_response)

 Module tw.core.middleware:59 in wsgi_app
<http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
view <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>

<<  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>
else:
                       # Pass request downstream
                       resp = req.get_response(self.application)
                   return resp(environ, start_response)
               finally:

>>  <http://192.168.1.111:8080/post_login?__logins=0&came_from=%2Fhome#>resp
= req.get_response(self.application)






how to solve this problem, thank you very much.


Yours
Faithfully

Jeffrey Hsu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to