[Zope-Checkins] CVS: Zope/lib/python/Products/ZReST - ZReST.py:1.6.12.10

Florent Guillaume fg at nuxeo.com
Sun Nov 21 12:47:51 EST 2004


Update of /cvs-repository/Zope/lib/python/Products/ZReST
In directory cvs.zope.org:/tmp/cvs-serv22692

Modified Files:
      Tag: Zope-2_7-branch
	ZReST.py 
Log Message:
Check REQUEST in source_txt too. (Collector #1572)
Use proper if REQUEST is not None everywhere.


=== Zope/lib/python/Products/ZReST/ZReST.py 1.6.12.9 => 1.6.12.10 ===
--- Zope/lib/python/Products/ZReST/ZReST.py:1.6.12.9	Sat Nov 20 11:03:13 2004
+++ Zope/lib/python/Products/ZReST/ZReST.py	Sun Nov 21 12:47:51 2004
@@ -32,7 +32,7 @@
     # validate the instance_home
     self._setObject(id, ZReST(id))
     self._getOb(id).manage_upload(file)
-    if REQUEST:
+    if REQUEST is not None:
         return self.manage_main(self, REQUEST)
 
 class Warnings:
@@ -87,8 +87,7 @@
     def index_html(self, REQUEST=None):
         ''' Getting the formatted text
         '''
-
-        if REQUEST:
+        if REQUEST is not None:
             REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset=%s' % self.output_encoding)
         return self.formatted
 
@@ -96,7 +95,8 @@
     def source_txt(self, REQUEST=None):
         ''' Getting the source text
         '''
-        REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding)
+        if REQUEST is not None:
+            REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding)
         return self.source
 
     # edit form, which is also the primary interface
@@ -115,7 +115,7 @@
             self.source = data
             self.render()
 
-        if REQUEST:
+        if REQUEST is not None:
             message="Saved changes."
             return self.manage_main(self, REQUEST, manage_tabs_message=message)
 
@@ -167,7 +167,7 @@
             self.source = file.read()
         self.render()
 
-        if REQUEST:
+        if REQUEST is not None:
             message="Saved changes."
             return self.manage_main(self, REQUEST, manage_tabs_message=message)
 



More information about the Zope-Checkins mailing list