slivlenСпасибо за ссылки - я видел.
При прямом использовании MySQLDB все вроде работает. Как бы теперь заставить работать какой-нибудь ORM…
Но! С небольшой модификацией перенес код в проект на Pylons:
получаю:
Module netsales.controllers.homepage:11 in index
<< c.ps = test.select()
c.title = u'Индекс'
return render_response('homepage/index.html');
"""
def user(self):>> return render_response('homepage/index.html');
Module pylons.templating:356 in render_response
<<
response = pylons.response._current_obj()
response.content = render(*args, **kargs)
output_encoding = kargs.get('output_encoding')
encoding_errors = kargs.get('encoding_errors')>> response.content = render(*args, **kargs)
Module pylons.templating:337 in render
<< **cache_args)
return pylons.buffet.render(template_name=template, fragment=fragment,
format=format, namespace=kargs, **cache_args)
>> format=format, namespace=kargs, **cache_args)
Module pylons.templating:224 in render
<< log.debug("Rendering template %s with engine %s", full_path, engine_name)
return engine_config['engine'].render(namespace, template=full_path,
**options)>> **options)
Module mako.ext.turbogears:49 in render
<< info.update(self.extra_vars_func())
return template.render(**info)
>> return template.render(**info)
Module mako.template:114 in render
<< declared by this template's internal rendering method are also pulled from the given *args, **data
members. members."""
return runtime._render(self, self.callable_, args, data)
def render_unicode(self, *args, **data):>> return runtime._render(self, self.callable_, args, data)
Module mako.runtime:287 in _render
<< context = Context(buf, **data)
context._with_template = template
_render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
return context.pop_buffer().getvalue()>> _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
Module mako.runtime:304 in _render_context
<< # if main render method, call from the base of the inheritance stack
(inherit, lclcontext) = _populate_self_namespace(context, tmpl)
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
else:
# otherwise, call the actual rendering method specified>> _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
Module mako.runtime:337 in _exec_template
<< error_template.render_context(context, error=error)
else:
callable_(context, *args, **kwargs)>> callable_(context, *args, **kwargs)
Module homepage_index_html:29 in render_body
<< # SOURCE LINE 12
context.write(u' <li>')
context.write(unicode(pers.name))
context.write(u'</li>\n')
# SOURCE LINE 14
>> context.write(unicode(pers.name))
<type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Ну откуда там ascii???