[CMF-checkins] CVS: CMF/CMFDecor/Extensions - Install.py:1.3

Jens Vagelpohl jens@zope.com
Thu, 30 Aug 2001 16:29:47 -0400


Update of /cvs-repository/CMF/CMFDecor/Extensions
In directory cvs.zope.org:/tmp/cvs-serv12137

Modified Files:
	Install.py 
Log Message:
install file can now be run again and again without blowing up


=== CMF/CMFDecor/Extensions/Install.py 1.2 => 1.3 ===
 import string
 
+ZPT_SKINS_DIRS = ( 'zpt_content', 'zpt_control', 'zpt_generic', 'zpt_images' )
+
 def install(self):
     " Register the ZPT Skins with portal_skins and friends "
     out = StringIO()
     skinstool = getToolByName(self, 'portal_skins')
 
+    for dir_view in ZPT_SKINS_DIRS:
+        if dir_view in skinstool.objectIds():
+            skinstool._delObject( dir_view )
+
     addDirectoryViews( skinstool, 'skins', cmfdecor_globals )
     out.write( "Added CMFDecor directory views to portal_skins\n" )
 
@@ -123,11 +129,7 @@
 
         path = skinstool.getSkinPath( skinstool.getDefaultSkin() )
         path = map( string.strip, string.split( path,',' ) )
-        for zptdir in ( 'zpt_content'
-                      , 'zpt_control'
-                      , 'zpt_generic'
-                      , 'zpt_images'
-                      ):
+        for zptdir in ZPT_SKINS_DIRS:
             try:
                 path.insert( path.index( 'content' ), zptdir )
             except ValueError: