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 #2080 (closed enhancement: fixed)

Opened 11 years ago

Last modified 10 years ago

tg.redirect does not support list arguments

Reported by: jorge.vargas Owned by: faide
Priority: low Milestone: 2.0b5
Component: TurboGears Version: trunk
Severity: major Keywords:
Cc:

Description

In TG1 the following, is valid

redirect(['/paste', guid])

while in TG2 it fails with a traceback. Looking at the code for redirect/url this behavior was ported to TG2 for url but not for redirect which I think it's a bug.

Attachments

tg-url.diff Download (946 bytes) - added by amcgregor 10 years ago.
Patch to solve backwards-compatibility issue. Requires additional testing.

Change History

comment:1 Changed 11 years ago by mramm

  • Priority changed from normal to low
  • Type changed from defect to enhancement

Neither url, or redirect now support list arguments. Both could be fixed, but I don't think this is critical, as you can just build the string in the redirect call.

redirect("/paste/"+guid)

would do the same thing as above.

If somebody wants to implement this the right place to do it is now in the url wrapper in tg.controllers, but it's very low priority for me.

comment:2 Changed 10 years ago by amcgregor

  • Severity changed from normal to major

I have hundreds, if not thousands, of tg.url() calls in both controller and template code, and, sadly, a production environment that lags behind my development one for a number of reasons. (Primarily testing b3 before upgrading prod. to it.) I'll be attaching a patch to this ticket which solves this backwards-compatibility-breaking problem.

comment:3 Changed 10 years ago by amcgregor

After some testing, the url function behaves quite differently from the way it did before; after upgrading to b3 I entered Bizarro world. The isinstance conditional code in the patch should be updated to ['/'.join(components)] + ... instead of simply combining the values. Now the previous call structure continues to work and does not impede the new style of call (which I haven't figured out, yet).

Changed 10 years ago by amcgregor

Patch to solve backwards-compatibility issue. Requires additional testing.

comment:4 follow-up: ↓ 5 Changed 10 years ago by mramm

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from 2.0 to 2.0b5

I believe I put in a fix that doesn't change the signature of url, and which provides the backwards compatibility requested.

Fix checked in in #6245, missed the tests, so they are in #6246 along with a docstring update.

comment:5 in reply to: ↑ 4 Changed 10 years ago by jorge.vargas

Fixing typo's for revs not tickets

Fix checked in in r6245, missed the tests, so they are in r6246 along with a docstring update.

Note: See TracTickets for help on using tickets.