mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #1046 -- Made syndication feed framework not swallow TypeErrors in functions. Thanks, junzhang.jn
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
25b149a2a5
commit
bb8500449b
1
AUTHORS
1
AUTHORS
@ -61,6 +61,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Robert Rock Howard <http://djangomojo.com/>
|
Robert Rock Howard <http://djangomojo.com/>
|
||||||
Jason Huggins <http://www.jrandolph.com/blog/>
|
Jason Huggins <http://www.jrandolph.com/blog/>
|
||||||
Michael Josephson <http://www.sdjournal.com/>
|
Michael Josephson <http://www.sdjournal.com/>
|
||||||
|
junzhang.jn@gmail.com
|
||||||
Russell Keith-Magee <freakboy@iinet.net.au>
|
Russell Keith-Magee <freakboy@iinet.net.au>
|
||||||
Garth Kidd <http://www.deadlybloodyserious.com/>
|
Garth Kidd <http://www.deadlybloodyserious.com/>
|
||||||
Sune Kirkeby <http://ibofobi.dk/>
|
Sune Kirkeby <http://ibofobi.dk/>
|
||||||
|
@ -33,9 +33,17 @@ class Feed:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
return default
|
return default
|
||||||
if callable(attr):
|
if callable(attr):
|
||||||
try:
|
# Check func_code.co_argcount rather than try/excepting the
|
||||||
|
# function and catching the TypeError, because something inside
|
||||||
|
# the function may raise the TypeError. This technique is more
|
||||||
|
# accurate.
|
||||||
|
if hasattr(attr, 'func_code'):
|
||||||
|
argcount = attr.func_code.co_argcount
|
||||||
|
else:
|
||||||
|
argcount = attr.__call__.func_code.co_argcount
|
||||||
|
if argcount == 2: # one argument is 'self'
|
||||||
return attr(obj)
|
return attr(obj)
|
||||||
except TypeError:
|
else:
|
||||||
return attr()
|
return attr()
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user