Django

Code

Ticket #1046 (closed: fixed)

Opened 3 years ago

Last modified 3 years ago

[patch]syndication_feeds's bug for TypeError

Reported by: junzhang.jn@gmail.com Assigned to: adrian
Milestone: Component: RSS framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

at feeds.py's line 35:

if callable(attr):
    try:
        return attr(obj)
    except TypeError:
        return attr()

this code will hide TypeError? that zhe 'attr(obj)' function throws. so , i use below code to fix the little bug.

if callable(attr):
    if hasattr( attr , 'func_code' ):
        argcount = attr.func_code.co_argcount
    else:
        argcount = attr.__call__.func_code.co_argcount
    if argcount == 2:
        # one is self
        return attr(obj)
    else:
        return attr()

Attachments

Change History

02/18/06 14:34:15 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [2341]) Fixed #1046 -- Made syndication feed framework not swallow TypeErrors? in functions. Thanks, junzhang.jn


Add/Change #1046 ([patch]syndication_feeds's bug for TypeError)




Change Properties
Action