summaryrefslogtreecommitdiff
path: root/cherrypy/lib/sessions.py
diff options
context:
space:
mode:
authorAllan Crooks <allan@amcone.net>2014-04-15 17:52:58 -0400
committerAllan Crooks <allan@amcone.net>2014-04-15 17:52:58 -0400
commitab0ca3c15d293894d938e64c547e75d3497d50d3 (patch)
tree020dacb8e45adb294be221c555b86c2baab4867e /cherrypy/lib/sessions.py
parent2210cfadff4b59b673f8762bd2561b4d3a3558fa (diff)
downloadcherrypy-git-ab0ca3c15d293894d938e64c547e75d3497d50d3.tar.gz
Use is_iterator function to determine if the response content is iterable, rather than just testing if it is a generator.
This is in preparation for a fix for #1288. Note - we could test against collections.Iterator, but this seems like a cleaner way of doing it for now.
Diffstat (limited to 'cherrypy/lib/sessions.py')
-rw-r--r--cherrypy/lib/sessions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cherrypy/lib/sessions.py b/cherrypy/lib/sessions.py
index 23115c50..42c89d8c 100644
--- a/cherrypy/lib/sessions.py
+++ b/cherrypy/lib/sessions.py
@@ -101,6 +101,7 @@ from cherrypy._cpcompat import copyitems, pickle, random20, unicodestr
from cherrypy.lib import httputil
from cherrypy.lib import lockfile
from cherrypy.lib import locking
+from cherrypy.lib import is_iterator
missing = object()
@@ -778,7 +779,7 @@ def save():
else:
# If the body is not being streamed, we save the data now
# (so we can release the lock).
- if isinstance(response.body, types.GeneratorType):
+ if is_iterator(response.body):
response.collapse_body()
cherrypy.session.save()
save.failsafe = True