Annotation of kupu/__init__.py, revision 1.1.1.1
1.1 dwinter 1: ##############################################################################
2: #
3: # Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
4: #
5: # This software is distributed under the terms of the Kupu
6: # License. See LICENSE.txt for license text. For a list of Kupu
7: # Contributors see CREDITS.txt.
8: #
9: ##############################################################################
10: """kupu package initialization
11:
12: This module does some twirks to let us use kupu with Zope2, CMF/Plone
13: and Zope3
14:
15: $Id: __init__.py 14575 2005-07-12 20:18:12Z duncan $
16: """
17:
18: # we need this for the CMF install script
19: kupu_globals = globals()
20:
21: # test for Zope2
22: try:
23: import zope2
24: have_zope2 = 1
25: except ImportError:
26: have_zope2 = 0
27:
28: # test for CMF
29: try:
30: import Products.CMFCore
31: have_cmf = 1
32: except ImportError:
33: have_cmf = 0
34:
35: # test for Plone, removed because Plone isn't supported yet
36: try:
37: import Products.CMFPlone
38: have_plone = 1
39: except ImportError:
40: have_plone = 0
41:
42: # test for FileSystemSite
43: try:
44: import Products.FileSystemSite
45: have_fss = 1
46: except ImportError:
47: have_fss = 0
48:
49: # do the minimal stuff for skin registering
50: # note that CMF/Plone users will still have to run the
51: # Extensions/Install.py script
52: if have_cmf:
53: # Need to do this in case Archetypes isn't present.
54: from Products.CMFCore.FSFile import FSFile
55: from Products.CMFCore.DirectoryView import registerFileExtension, registerDirectory
56: registerFileExtension('xsl', FSFile)
57: registerDirectory('common', globals())
58:
59: if have_plone:
60: from Products.kupu.plone import initialize
61:
62: elif have_zope2 and have_fss:
63: import zope2
64: initialize = zope2.initialize
65:
66: if have_zope2:
67: # in Zope 2, make all modules in the 'python' lib available
68: def __allow_access_to_unprotected_subobjects__(name, value=None):
69: return name in ('python')
70:
71: from AccessControl import allow_module
72: allow_module('Products.kupu.python.nationalizer')
73: allow_module('Products.kupu.python.spellcheck')
74:
75: # do nothing for zope3 (all is done in zcml)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>