Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2115 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Write tg.url wrapper

Reported by: mramm Owned by: faide
Priority: normal Milestone: 2.0b3
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description

As mentioned in #2085

pylons url does not support unicode strings, and we should support them out of the box if possible. We can also add some backwards compatability helpers at the same time.

  • Support a params dict like tg1
  • Support passing a list of strings like tg1

Change History

comment:1 Changed 10 years ago by mramm

I implemented something basic in tg2 already, but it turns out that routes does not support utf8 encoded strings either, so there is still not full support.

We can either update routes to support utf-8 encoded strings, or we can work with the older iri way of doing things.

There's a webhelpers helper that we can use to encode the unicode strings before passing them to pylons.url.

 http://docs.pylonshq.com/thirdparty/webhelpers/util.html#webhelpers.util.iri_to_uri

comment:2 Changed 10 years ago by mramm

  • Status changed from new to closed
  • Resolution set to fixed

This is pretty much fixed n #6000. I was having trouble with iri_to_uri from webhelpers, which did not encode all asci strings properly, which turned out to be a problem in the quote function of urllib -- so now we have our own encoder adapted from Joe Gregario's encoder in httplib2:

 http://code.google.com/p/httplib2/source/browse/trunk/httplib2/iri2uri.py

I feel like this solution is a bit ugly and low-level to live in turbogears2 itself, but I'm not sure what else to do at this point since routes does not handle unicode.

comment:3 Changed 10 years ago by mramm

  • Status changed from closed to reopened
  • Resolution fixed deleted

Looks like there was a bug in routes with minimization turned off so we may be able to drop this as a temporary fix.

comment:4 Changed 10 years ago by mramm

  • Milestone changed from 2.0b2 to 2.0b3

comment:5 Changed 10 years ago by mramm

  • Status changed from reopened to closed
  • Resolution set to fixed

This is now fixed so params works, and unicode parameters work. and the hacks in tg2 are removed because routes is updated to make unicode parameters work too.

Note: See TracTickets for help on using tickets.