[CMF-checkins] CVS: CMF/CMFDefault - DefaultWorkflow.py:1.13 Document.py:1.48 __init__.py:1.13 utils.py:1.14

Tres Seaver tseaver@zope.com
Sun, 21 Jul 2002 20:01:56 -0400


Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv462/CMFDefault

Modified Files:
	DefaultWorkflow.py Document.py __init__.py utils.py 
Log Message:



  - Merge 'utils' fixes (including 'scrubHTML' integration) from 1.3 branch.


=== CMF/CMFDefault/DefaultWorkflow.py 1.12 => 1.13 ===
 # FOR A PARTICULAR PURPOSE
 # 
 ##############################################################################
-'''
-A simple submit/review/publish workflow.
+''' A simple submit/review/publish workflow.
+
 $Id$
 '''
-__version__='$Revision$'[11:-2]
 
 import sys
 import Globals
 from Acquisition import aq_base, aq_inner, aq_parent
 from AccessControl import ClassSecurityInfo
 from DateTime import DateTime
-from Products.CMFCore.utils import modifyPermissionMappings, _checkPermission
-from Products.CMFCore.utils import getToolByName, SimpleItemWithProperties
+from Products.CMFCore.utils import _modifyPermissionMappings
+from Products.CMFCore.utils import _checkPermission
+from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import SimpleItemWithProperties
 from Products.CMFCore.WorkflowCore import WorkflowException
 from Products.CMFCore.WorkflowTool import addWorkflowClass
 
@@ -301,12 +302,13 @@
 
         # Modify role to permission mappings directly.
 
-        return modifyPermissionMappings(ob,
-            {'View': {'Anonymous': anon_view,
-                      'Reviewer': reviewer_view,
-                      'Owner': 1,
-                      },
-             'Modify portal content': {'Owner': owner_modify}})
+        new_map = { 'View': { 'Anonymous': anon_view
+                            , 'Reviewer': reviewer_view
+                            , 'Owner': 1
+                            }
+                  , 'Modify portal content': {'Owner': owner_modify}
+                  }
+        return _modifyPermissionMappings(ob, new_map)
 
 Globals.InitializeClass(DefaultWorkflowDefinition)
 


=== CMF/CMFDefault/Document.py 1.47 => 1.48 ===
 from Products.CMFCore.PortalContent import NoWL, ResourceLockedError
 from Products.CMFCore import CMFCorePermissions
 from Products.CMFCore.WorkflowCore import WorkflowAction
-from Products.CMFCore.utils import _format_stx, keywordsplitter
+from Products.CMFCore.utils import format_stx, keywordsplitter
 from DublinCore import DefaultDublinCoreImpl
 from utils import parseHeadersBody, formatRFC822Headers
 from utils import SimpleHTMLParser, bodyfinder, _dtmldir
@@ -147,7 +147,7 @@
             self.text = text
             self.cooked_text = html_quote(text).replace('\n','<br>')
         else:
-            self.cooked_text = _format_stx(text=text, level=level)
+            self.cooked_text = format_stx(text=text, level=level)
             self.text = text
 
     security.declareProtected( CMFCorePermissions.ModifyPortalContent, 'edit' )
@@ -302,7 +302,7 @@
             or (stx_level == self._stx_level)):
             return self.cooked_text
         else:
-            cooked = _format_stx(self.text, stx_level)
+            cooked = format_stx(self.text, stx_level)
             if setlevel:
                 self._stx_level = stx_level
                 self.cooked_text = cooked


=== CMF/CMFDefault/__init__.py 1.12 => 1.13 ===
 """
 
 ADD_CONTENT_PERMISSION = 'Add portal content'
+
+from AccessControl import ModuleSecurityInfo
+
+prod_security = ModuleSecurityInfo( 'Products' )
+prod_security.declarePublic( 'CMFDefault' )
+
+security = ModuleSecurityInfo( 'Products.CMFDefault' )
+security.declarePublic( 'utils' )
  
 import Portal
 import Document, Link, NewsItem, File, Image, Favorite, SkinnedFolder


=== CMF/CMFDefault/utils.py 1.13 => 1.14 ===
 import os
 
 from Globals import package_home
+from AccessControl import ModuleSecurityInfo
+
+security = ModuleSecurityInfo( 'Products.CMFDefault.utils' )
+
+security.declarePublic( 'formatRFC822Headers'
+                      , 'parseHeadersBody'
+                      , 'semi_split'
+                      , 'comma_split'
+                      , 'seq_strip'
+                      , 'tuplize'
+                      , 'scrubHTML'
+                      , 'isHTMLSafe'
+                      , 'bodyfinder'
+                      , 'html_headcheck'
+                      )
+
+security.declarePrivate( '_dtmldir'
+                       , '_bodyre'
+                       , '_endbodyre'
+                       , '_htfinder'
+                       )
 
 _dtmldir = os.path.join( package_home( globals() ), 'dtml' )
 
@@ -362,13 +383,13 @@
     else:
         return text[bod.end():end.start()]
 
-htfinder = re.compile( r'<html', re.DOTALL | re.I )
+_htfinder = re.compile( r'<html', re.DOTALL | re.I )
 
 def html_headcheck( html ):
 
     """ Return 'true' if document looks HTML-ish enough.
     """
-    if not htfinder.search(html):
+    if not _htfinder.search(html):
         return 0
 
     lines = re.split(r'[\n\r]+?', html)