Some optimizations, cleanup and a few bugfixes. Just changing a spurious property retrieval in the typeclass removed an extra, pointless database query.

This commit is contained in:
Griatch 2012-09-18 01:03:35 +02:00
parent 160d4a2807
commit 0dae03156c
5 changed files with 57 additions and 38 deletions

View file

@ -34,7 +34,13 @@ def is_iter(iterable):
they are actually iterable), since string iterations
are usually not what we want to do with a string.
"""
return hasattr(iterable, '__iter__')
# use a try..except here to avoid a property
# lookup when using this from a typeclassed entity
try:
_GA(iterable, '__iter__')
return True
except AttributeError:
return False
def make_iter(obj):
"Makes sure that the object is always iterable."