Fixed #3377 -- Fixed subtle infinite recursion bug in LazyDate objects. Thanks

to brut.alll@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-02-13 06:06:09 +00:00
parent a4ddecd15c
commit ba9649f966
2 changed files with 6 additions and 0 deletions

View File

@ -57,6 +57,7 @@ answer newbie questions, and generally made Django that much better:
Paul Bissex <http://e-scribe.com/> Paul Bissex <http://e-scribe.com/>
Simon Blanchard Simon Blanchard
Andrew Brehaut <http://brehaut.net/blog> Andrew Brehaut <http://brehaut.net/blog>
brut.alll@gmail.com
Jonathan Buchanan <jonathan.buchanan@gmail.com> Jonathan Buchanan <jonathan.buchanan@gmail.com>
Antonio Cavedoni <http://cavedoni.com/> Antonio Cavedoni <http://cavedoni.com/>
C8E C8E

View File

@ -50,4 +50,9 @@ class LazyDate(object):
return (datetime.datetime.now() + self.delta).date() return (datetime.datetime.now() + self.delta).date()
def __getattr__(self, attr): def __getattr__(self, attr):
if attr == 'delta':
# To fix ticket #3377. Note that normal access to LazyDate.delta
# (after construction) will still work, because they don't go
# through __getattr__). This is mainly needed for unpickling.
raise AttributeError
return getattr(self.__get_value__(), attr) return getattr(self.__get_value__(), attr)