Author: kmtracey
Date: 2010-03-22 14:16:31 -0500 (Mon, 22 Mar 2010)
New Revision: 12835

Modified:
   django/branches/releases/1.1.X/
   django/branches/releases/1.1.X/django/template/__init__.py
   django/branches/releases/1.1.X/tests/regressiontests/templates/tests.py
Log:
[1.1.X] Fixed #12554 again: Corrected regression in silencing attribute lookups 
introduced in r12824, plus added a test for this so it doesn't regress again. 

r12834 from trunk.



Property changes on: django/branches/releases/1.1.X
___________________________________________________________________
Name: svnmerge-integrated
   - 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11802,11808,11815,11817,11820,11822,11824,11826,11828,11831,11833,11835,11837,11839,11841,11844,11857,11864,11874,11876,11878,11885,11898,11901,11905,11909,11912,11914,11917,11938,11953,11961,11977,11979,11984,11986,11988,11990,11992,11994,11996,11998,12001,12004,12006,12011,12022,12024,12044-12045,12048,12054-12056,12059,12064,12066,12068,12070,12079,12086,12088,12104,12118,12132,12137-12138,12140-12141,12144,12150-12152,12220-12221,12229,12249,12253,12276,12282,12284,12293,12313,12317-12324,12333,12341,12343,12346,12353,12362,12379,12384,12398,12405,12408-12411,12419-12420,12423,12425-12426,12429,12434,12436,12439-12442,12447-12448,12457,12461-12464,12467,12471,12473,12475,12484,12489-12490,12492,12497-12498,12502,12505,12513,12515-12516,12518,12523,12525-12526,12528-12531,12533-12542,12548-12550,12553-12554,12556-12560,12562-12573,12575-12577,12579,12581-12585,12587,12589,12591-12596,12598-12610,12613-12617,12621-12623,12627-12632,12635-12642,12644-12655,12657-12674,12676-12683,12686-12689,12692,12694-12700,12702-12706,12710-12716,12719-12729,12731,12733-12740,12758,12760-12761,12763,12765,12767,12769,12772,12774-12777,12779,12781,12783,12789,12795-12796,12799-12801,12807,12809,12812-12813,12819,12821,12823,12828,12830,12832
   + 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11802,11808,11815,11817,11820,11822,11824,11826,11828,11831,11833,11835,11837,11839,11841,11844,11857,11864,11874,11876,11878,11885,11898,11901,11905,11909,11912,11914,11917,11938,11953,11961,11977,11979,11984,11986,11988,11990,11992,11994,11996,11998,12001,12004,12006,12011,12022,12024,12044-12045,12048,12054-12056,12059,12064,12066,12068,12070,12079,12086,12088,12104,12118,12132,12137-12138,12140-12141,12144,12150-12152,12220-12221,12229,12249,12253,12276,12282,12284,12293,12313,12317-12324,12333,12341,12343,12346,12353,12362,12379,12384,12398,12405,12408-12411,12419-12420,12423,12425-12426,12429,12434,12436,12439-12442,12447-12448,12457,12461-12464,12467,12471,12473,12475,12484,12489-12490,12492,12497-12498,12502,12505,12513,12515-12516,12518,12523,12525-12526,12528-12531,12533-12542,12548-12550,12553-12554,12556-12560,12562-12573,12575-12577,12579,12581-12585,12587,12589,12591-12596,12598-12610,12613-12617,12621-12623,12627-12632,12635-12642,12644-12655,12657-12674,12676-12683,12686-12689,12692,12694-12700,12702-12706,12710-12716,12719-12729,12731,12733-12740,12758,12760-12761,12763,12765,12767,12769,12772,12774-12777,12779,12781,12783,12789,12795-12796,12799-12801,12807,12809,12812-12813,12819,12821,12823,12828,12830,12832,12834

Modified: django/branches/releases/1.1.X/django/template/__init__.py
===================================================================
--- django/branches/releases/1.1.X/django/template/__init__.py  2010-03-22 
19:08:04 UTC (rev 12834)
+++ django/branches/releases/1.1.X/django/template/__init__.py  2010-03-22 
19:16:31 UTC (rev 12835)
@@ -735,6 +735,11 @@
                             TypeError,  # unsubscriptable object
                             ):
                         raise VariableDoesNotExist("Failed lookup for key [%s] 
in %r", (bit, current)) # missing attribute
+                except Exception, e:
+                    if getattr(e, 'silent_variable_failure', False):
+                        current = settings.TEMPLATE_STRING_IF_INVALID
+                    else:
+                        raise
             except Exception, e:
                 if getattr(e, 'silent_variable_failure', False):
                     current = settings.TEMPLATE_STRING_IF_INVALID

Modified: 
django/branches/releases/1.1.X/tests/regressiontests/templates/tests.py
===================================================================
--- django/branches/releases/1.1.X/tests/regressiontests/templates/tests.py     
2010-03-22 19:08:04 UTC (rev 12834)
+++ django/branches/releases/1.1.X/tests/regressiontests/templates/tests.py     
2010-03-22 19:16:31 UTC (rev 12835)
@@ -100,6 +100,11 @@
     def __getitem__(self, key):
         raise SomeException
 
+class SilentAttrClass(object):
+    def b(self):
+        raise SomeException
+    b = property(b)
+
 class UTF8Class:
     "Class whose __str__ returns non-ASCII data"
     def __str__(self):
@@ -350,8 +355,9 @@
 
             # regression test for ticket #12554
             # make sure a silent_variable_failure Exception is supressed
-            # on dictionary lookup
+            # on dictionary and attribute lookup
             'basic-syntax28': ("{{ a.b }}", {'a': SilentGetItemClass()}, ('', 
'INVALID')),
+            'basic-syntax29': ("{{ a.b }}", {'a': SilentAttrClass()}, ('', 
'INVALID')),
 
             # List-index syntax allows a template to access a certain item of 
a subscriptable object.
             'list-index01': ("{{ var.1 }}", {"var": ["first item", "second 
item"]}, "second item"),

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to