Ticket #2444 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

TG 2.1a3 dispatcher mistakenly assumes all required positional parameters are provided

Reported by: mcfletch Assigned to:
Priority: normal Milestone: 2.1b1
Component: TurboGears Version: 2.1a3
Severity: normal Keywords:
Cc:

Description

At line 145 of dispatcher.py, the code makes the assumption that it can do remainder[i]. If the user provides 1 parameter positionally (i.e. as part of the URL) and the next via keyword argument, the handler raises an exception trying to assign remainder[i]... fix:

for i,var in enumerate(required_vars):

if i < len(remainder):

remainder[i] = params[var] del params[var]

that is, check for i< len(remainder) before attempting to assign to it.

Change History

01/23/10 22:09:32 changed by percious

did you try tip?

I just fixed this mess.

01/23/10 22:59:08 changed by mcfletch

Sorry, didn't try tip, am in the middle of porting a project for PyCon? and was just wanting to make sure this didn't get lost in the meantime. If it's already fixed, please feel free to close this.

01/24/10 01:17:29 changed by mcfletch

There was still a bug in tip for the handling of positional parameters with defaults. Pull http://bitbucket.org/mcfletch/tg-dev/ to get the fix, test, etc.

01/26/10 20:17:57 changed by percious

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from __unclassified__ to 2.1b1.