[Zope-CMF] CMFBoringContent.
Jens Vagelpohl
jens@zope.com
Mon, 6 Aug 2001 07:58:28 -0400
erik,
here is a code snippet that i am using::
for skin_name in SKINS:
if skin_name in installed_skins:
skins_tool._delObject( skin_name )
addDirectoryViews( skins_tool, 'skins', my_globals )
notice that i don't use "globals()" directly, my_globals is actually
defined in my __init__.py as::
my_globals = globals()
and then i import it into the script::
from Products.MyProduct import my_globals
i can't give you the detailed technical explanation why this works as
opposed to using globals() directly in the script, i just know this works.
HTH
jens
On Monday, August 6, 2001, at 04:05 , Erik Enge wrote:
> [marc lindahl]
>
> | > From: Tres Seaver <tseaver@palladion.com>
> | > Qell-behaved CMF Products also provide
> | > a script to be used as an ExternalMethod for doing the "standard"
> | > installation steps you note for a specific CMFSite instance.
> |
> | I'd love to see that as part of CMFBoring!
>
> CMFBoring should be a well-behaved CMF Product :)
>
> I've written that install script, but I'm running into some problems
> when trying to test it. This code:
>
> # Setup the skins
> if 'CMFBoringContent' not in skinstool.objectIds():
> # We need to add Filesystem Directory Views for any directories
> # in our skins/ directory. These directories should already be
> # configured.
> addDirectoryViews(skinstool, 'skins', globals())
> out.write("Added 'CMFBoringContent' directory view to
> portal_skins\n")
>
> Yields this traceback:
>
> Error Type: KeyError
> Error Value: __name__
>
> Traceback (innermost last):
> File /home/erik/development/zope-farm/Zope-2.3.3-linux2-x86/lib/python/
> ZPublisher/Publish.py, line 223, in publish_module
> [snip]
> File /home/erik/development/zope-farm/Zope-2.3.3-linux2-x86/Extensions/
> Install.py, line 32, in install
> (Object: Traversable)
> File /home/erik/development/zope-farm/Zope-2.3.3-linux2-x86/lib/python/
> Products/CMFCore/DirectoryView.py, line 446, in addDirectoryViews
> (Object: SkinsContainer)
> File /home/erik/development/zope-farm/Zope-2.3.3-linux2-x86/lib/python/
> App/Common.py, line 160, in package_home
> KeyError: (see above)
>
> Anyone?
>