[Checkins] SVN: CMF/trunk/CMFDefault/DiscussionTool.py Fix unsafe hasattr usage

Wichert Akkerman wichert at wiggy.net
Sun Feb 25 19:15:11 EST 2007


Log message for revision 72807:
  Fix unsafe hasattr usage

Changed:
  U   CMF/trunk/CMFDefault/DiscussionTool.py

-=-
Modified: CMF/trunk/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/DiscussionTool.py	2007-02-25 21:37:33 UTC (rev 72806)
+++ CMF/trunk/CMFDefault/DiscussionTool.py	2007-02-26 00:15:10 UTC (rev 72807)
@@ -41,6 +41,8 @@
 from utils import _dtmldir
 
 
+_marker = []
+
 class DiscussionTool( UniqueObject, SimpleItem, ActionProviderBase ):
 
     """ Links content to discussions.
@@ -78,7 +80,7 @@
             raise AccessControl_Unauthorized
 
         if allowDiscussion is None or allowDiscussion == 'None':
-            if hasattr( aq_base(content), 'allow_discussion'):
+            if getattr( aq_base(content), 'allow_discussion', _marker) is not _marker:
                 del content.allow_discussion
         else:
             content.allow_discussion = bool(allowDiscussion)



More information about the Checkins mailing list