Opened 5 years ago

Closed 5 years ago

#17472 closed Bug (wontfix)

RequestContext function with dict={} kwarg paramater fails

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.4-alpha-1
Severity: Normal Keywords: RequestContext
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


1.4 introduces changes in RequestContext that renders the following non-functional:

c = RequestContext(request, dict={
        'promotion':            promotion,
        'products_dict':        products_dict,

The following will work:

c = RequestContext(request, {
        'promotion':            promotion,
        'products_dict':        products_dict,

It's probably a good idea to make the 1.4 changes backwards compatible, allowing dict={} as a param to RequestContext.

Change History (2)

comment:1 Changed 5 years ago by anonymous

Component: UncategorizedTemplate system
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Severity: NormalRelease blocker
Type: UncategorizedCleanup/optimization

comment:2 Changed 5 years ago by Luke Plant

Resolution: wontfix
Severity: Release blockerNormal
Status: newclosed
Type: Cleanup/optimizationBug

I'm going to WONTFIX this, because:

1) Passing the dictionary as a keyword argument has never been documented - it has always been an optional second positional argument, AFAICS. Therefore we don't have to support it.

2) Although it would nice to maintain this backwards compatibility if possible, there are positive reasons for the change:

2.1) Consistency with Context which names the the argument 'dict_', and has done since at least 1.3.X.

2.2) 'dict' is a poor choice of variable name, since it causes the builtin 'dict' to be shadowed.

Note: See TracTickets for help on using tickets.
Back to Top