Django

Code

Changeset 2341

Show
Ignore:
Timestamp:
02/18/06 14:34:14 (3 years ago)
Author:
adrian
Message:

Fixed #1046 -- Made syndication feed framework not swallow TypeErrors? in functions. Thanks, junzhang.jn

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r2326 r2341  
    6262    Jason Huggins <http://www.jrandolph.com/blog/> 
    6363    Michael Josephson <http://www.sdjournal.com/> 
     64    junzhang.jn@gmail.com 
    6465    Russell Keith-Magee <freakboy@iinet.net.au> 
    6566    Garth Kidd <http://www.deadlybloodyserious.com/> 
  • django/trunk/django/contrib/syndication/feeds.py

    r1228 r2341  
    3434            return default 
    3535        if callable(attr): 
    36             try: 
     36            # Check func_code.co_argcount rather than try/excepting the 
     37            # function and catching the TypeError, because something inside 
     38            # the function may raise the TypeError. This technique is more 
     39            # accurate. 
     40            if hasattr(attr, 'func_code'): 
     41                argcount = attr.func_code.co_argcount 
     42            else: 
     43                argcount = attr.__call__.func_code.co_argcount 
     44            if argcount == 2: # one argument is 'self' 
    3745                return attr(obj) 
    38             except TypeError
     46            else
    3947                return attr() 
    4048        return attr