[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/ZReST.py Check REQUEST in source_txt too. (Collector #1572)

Florent Guillaume fg at nuxeo.com
Sun Nov 21 12:45:39 EST 2004


Log message for revision 28483:
  Check REQUEST in source_txt too. (Collector #1572)
  Use proper if REQUEST is not None everywhere.
  

Changed:
  U   Zope/trunk/lib/python/Products/ZReST/ZReST.py

-=-
Modified: Zope/trunk/lib/python/Products/ZReST/ZReST.py
===================================================================
--- Zope/trunk/lib/python/Products/ZReST/ZReST.py	2004-11-20 20:25:23 UTC (rev 28482)
+++ Zope/trunk/lib/python/Products/ZReST/ZReST.py	2004-11-21 17:45:39 UTC (rev 28483)
@@ -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,7 +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
 
@@ -95,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
@@ -114,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)
 
@@ -166,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