Sorry for bothering you with this crap. I have just upgraded to routes
1.8 and everything works fine now.
Thank you none the less.

On 29 Apr., 08:56, Saibot <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have already reached a dead end, although I am still at the
> beginning of my project.
> Perhaps somebody can help me out of this mess:
>
> I am trying to write a tool to browse data in databases. Unfortunately
> the database I am working with
> is a ms-sql database which has german umlauts in its table- and cloumn
> names. When reflecting tables from
> this database I have to overwrite the columnames with ascii-names to
> allow sqlalchemy to map the tables to classes.
> sqlalchemy.convert_unicode is true and sqlalchemy.encoding is set to
> cp1252.
> So far so good.
> Now I want to display my tables in a generic way:
>
> [Controller]
> c.table=table
> column = request.GET.get('column')
> c.columns = meta.metadata.tables.get(table).c
> c.items =
> meta.metadata.tables.get(table).select().order_by(column).limit(10).execute­()
> return render('/databrowse/table.html')
>
> [View]
> <table>
> <tr>
> % for column in c.columns:
> <th>
>     <a href="${h.url_for(controller="databrowse", action="table",
> table=c.table, column=column.name)}">${column.name}</a>
> </th>
> % endfor
> </tr>
>
> % for item in c.items:
> <tr>
> % for column in c.columns:
>   <td>${item[column.name]}</td>
> % endfor
> </tr>
> % endfor
>
> </table>
>
> but routes produces some unicode error when calling
> h.url_for(controller="databrowse", action="table", table=c.table,
> column=column.name
> in the template:
>
> File 'c:\\TTL\\ttl\\controllers\\databrowse.py', line 29 in table
>   return render('/databrowse/table.html')
> File 'c:\\python25\\lib\\site-packages\\pylons-0.9.6.1-py2.5.egg\
> \pylons\\templating.py', line 343 in render
>   format=format, namespace=kargs, **cache_args)
> File 'c:\\python25\\lib\\site-packages\\pylons-0.9.6.1-py2.5.egg\
> \pylons\\templating.py', line 228 in render
>   **options)
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\\ext
> \\turbogears.py', line 49 in render
>   return template.render(**info)
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\
> \template.py', line 114 in render
>   return runtime._render(self, self.callable_, args, data)
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\
> \runtime.py', line 287 in _render
>   _render_context(template, callable_, context, *args,
> **_kwargs_for_callable(callable_, data))
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\
> \runtime.py', line 304 in _render_context
>   _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\
> \runtime.py', line 337 in _exec_template
>   callable_(context, *args, **kwargs)
> File 'c:\\TTL\\data\\templates\\databrowse\\site.html.py', line 26 in
> render_body
>   context.write(unicode(self.body()))
> File 'c:\\python25\\lib\\site-packages\\mako-0.1.8-py2.5.egg\\mako\
> \runtime.py', line 193 in <lambda>
>   return lambda *args, **kwargs:callable_(self.context, *args,
> **kwargs)
> File 'c:\\TTL\\data\\templates\\databrowse\\table.html.py', line 38 in
> render_body
>   context.write(unicode(h.url_for(controller="databrowse",
> action="table", table=c.table, column=column.name)))
> File 'c:\\python25\\lib\\site-packages\\routes-1.7.1-py2.5.egg\\routes\
> \util.py', line 189 in url_for
>   url = config.mapper.generate(*route_args, **newargs)
> File 'c:\\python25\\lib\\site-packages\\routes-1.7.1-py2.5.egg\\routes\
> \base.py', line 949 in generate
>   path = route.generate(**kargs)
> File 'c:\\python25\\lib\\site-packages\\routes-1.7.1-py2.5.egg\\routes\
> \base.py', line 544 in generate
>   (key != 'action' or key != 'controller')])
> File 'C:\\Python25\\lib\\urllib.py', line 1250 in urlencode
>   v = quote_plus(str(v))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in
> position 6: ordinal not in range(128)
>
> Can anybody explain me what I am doing wrong?
>
> Thanks in advance!

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

Reply via email to