[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py Catch all exceptions; it's not required to be able to determine length.
Malthe Borch
mborch at gmail.com
Tue Nov 25 09:21:05 EST 2008
Log message for revision 93341:
Catch all exceptions; it's not required to be able to determine length.
Changed:
U Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py
-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py 2008-11-25 14:20:12 UTC (rev 93340)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py 2008-11-25 14:21:04 UTC (rev 93341)
@@ -188,7 +188,9 @@
def insert(self, key, iterable):
try:
length = len(iterable)
- except TypeError:
+ except:
+ # we catch all exceptions here, because it's not required
+ # for iteration
length = None
try:
@@ -201,7 +203,9 @@
raise TypeError(
"Can only repeat over an iterable object (%s)." % iterable)
- self[key] = (iterator, length)
+ if length is not None:
+ self[key] = (iterator, length)
+
return iterator
def __getitem__(self, key):
More information about the Checkins
mailing list