tg admincontroller UnicodeDecodeError: 'utf8' problem

112 views
Skip to first unread message

alonn

unread,
Aug 6, 2012, 1:24:29 PM8/6/12
to turbo...@googlegroups.com
getting:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xee in position 0: invalid continuation byte

in one of my admincontrollers:

adminPriority = AdminController([Activities, Deposit, Ashmas], DBSession2, config_type=TGAdminConfig)

basicaly I have two db backends - so I need double DBSEssion etc, admin controller etc. the problematic one is the one working with mssql2005 (the mysql one works fine)
the controller shows me the right models but when I press one of them: (or any other model)
http://localhost:8080/adminPriority/activitiess/

instead of getting the default admin table view I get this annoying error.

both db backends work fine in the logic part of the application. the only difference is in the admincontroller.

I'd also like to get rid of the extra 'plural' form tg is adding to my models (turning activities into activitiess etc)

thanks for the help

Mengu

unread,
Aug 6, 2012, 6:05:22 PM8/6/12
to turbo...@googlegroups.com
hi,

do you have "# -*- coding: utf-8 -*-"  (without the quotes) on top of your controller file?

alonn

unread,
Aug 8, 2012, 4:49:41 PM8/8/12
to turbo...@googlegroups.com
if you mean root controller or crud in tgext.crud or controller in tgext.admin that yes, I have, if you mean something else please elaborate

Moritz Schlarb

unread,
Aug 13, 2012, 3:50:18 AM8/13/12
to turbo...@googlegroups.com
If you could show us the full traceback, that would be helpful.
Sadly, the "Upload to PylonsHQ"-Functionality is broken since some time so you would have to copy and paste it to something like paste.pocoo.org.

alonn

unread,
Aug 13, 2012, 1:02:40 PM8/13/12
to turbo...@googlegroups.com
here it is:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xee in position 0: invalid continuation byte
View as:   Interactive  |  Text  |  XML (full)
URL: http://localhost:8080/adminPriority/activitiess/
Module weberror.evalexception:431 in respond         view
>>  app_iter = self.application(environ, detect_start_response)
Module tg.configuration:825 in remover         view
>>  return app(environ, start_response)
Module repoze.tm:24 in __call__         view
>>  result = self.application(environ, save_status_and_headers)
Module repoze.who.middleware:107 in __call__         view
>>  app_iter = app(environ, wrapper.wrap_start_response)
Module tw.core.middleware:46 in __call__         view
>>  return self.wsgi_app(environ, start_response)
Module tw.core.middleware:72 in wsgi_app         view
>>  resp = req.get_response(self.application)
Module webob.request:1053 in get_response         view
>>  application, catch_exc_info=False)
Module webob.request:1022 in call_application         view
>>  app_iter = application(self.environ, start_response)
Module tw.core.resource_injector:70 in _injector         view
>>  resp = req.get_response(app)
Module webob.request:1053 in get_response         view
>>  application, catch_exc_info=False)
Module webob.request:1022 in call_application         view
>>  app_iter = application(self.environ, start_response)
Module beaker.middleware:73 in __call__         view
>>  return self.app(environ, start_response)
Module beaker.middleware:152 in __call__         view
>>  return self.wrap_app(environ, session_start_response)
Module routes.middleware:131 in __call__         view
>>  response = self.app(environ, start_response)
Module pylons.wsgiapp:107 in __call__         view
>>  response = self.dispatch(controller, environ, start_response)
Module pylons.wsgiapp:312 in dispatch         view
>>  return controller(environ, start_response)
Module priorityagent.lib.base:31 in __call__         view
>>  return TGController.__call__(self, environ, start_response)
Module pylons.controllers.core:211 in __call__         view
>>  response = self._dispatch_call()
Module pylons.controllers.core:162 in _dispatch_call         view
>>  response = self._inspect_call(func)
Module pylons.controllers.core:105 in _inspect_call         view
>>  result = self._perform_call(func, args)
Module tg.controllers.dispatcher:254 in _perform_call         view
>>  r = self._call(func, params, remainder=remainder)
Module tg.controllers.decoratedcontroller:116 in _call         view
>>  output = controller(*remainder, **dict(params))
Module tgext.crud.controller:120 in get_all         view
>>  values = self.table_filler.get_value(**kw)
Module sprox.fillerbase:218 in get_value         view
>>  value = unicode(value, encoding='utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xee in position 0: invalid continuation byte

Moritz Schlarb

unread,
Aug 13, 2012, 2:16:29 PM8/13/12
to turbo...@googlegroups.com
Invalid continuation byte, I haven't seen that before, but apparently you do supply some kind of string that is not encoded as utf-8 where it should be.


How is your model defined?
Are you using Column(Unicode()) or Column(String())?
Reply all
Reply to author
Forward
0 new messages