[CMF-checkins] CVS: CMF/CMFSetup - rolemap.py:1.5

Tres Seaver tseaver at zope.com
Sun May 23 23:12:12 EDT 2004


Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv31649

Modified Files:
	rolemap.py 
Log Message:


  - rolemap.py:

    o Clean up and test 'importRoleMap' and 'exportRoleMap';  include fairly
      brutal purging of any non-acquiered / local permissions or
      locally-created roles.


=== CMF/CMFSetup/rolemap.py 1.4 => 1.5 ===
--- CMF/CMFSetup/rolemap.py:1.4	Tue May 18 18:33:25 2004
+++ CMF/CMFSetup/rolemap.py	Sun May 23 23:12:08 2004
@@ -66,9 +66,6 @@
                                         , permission[ 'acquire' ]
                                         )
 
-#
-# Export
-#
 class RolemapConfigurator( Implicit ):
 
     """ Synthesize XML description of sitewide role-permission settings.
@@ -183,7 +180,20 @@
 
     """
     site = context.getSite()
-    text = context.readDatafile( FILENAME )
+
+    if context.shouldPurge():
+
+        items = site.__dict__.items()
+
+        for k, v in items: # XXX: WAAA
+
+            if k == '__ac_roles__':
+                delattr( site, k )
+
+            if k.startswith( '_' ) and k.endswith( '_Permission' ):
+                delattr( site, k )
+
+    text = context.readDataFile( _FILENAME )
 
     if text is not None:
 
@@ -220,6 +230,7 @@
       >Export additional roles, and role / permission map.</export-script>
 
     """
+    site = context.getSite()
     rc = RolemapConfigurator( site ).__of__( site )
     text = rc.generateXML()
 




More information about the CMF-checkins mailing list