[ Index ]
 

Code source de Kupu-1.3.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> __init__.py (source)

   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 22394 2006-01-18 15:45:19Z guido $
  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 as Zope
  24      have_zope2 = 1
  25  except ImportError:
  26      have_zope2 = 0
  27      
  28  if not have_zope2:
  29      try:
  30          import Zope
  31          have_zope2 = 1
  32      except ImportError:
  33          have_zope2 = 0
  34  
  35  # test for CMF
  36  try:
  37      import Products.CMFCore
  38      have_cmf = 1
  39  except ImportError:
  40      have_cmf = 0
  41  
  42  # test for Plone, removed because Plone isn't supported yet
  43  try:
  44      import Products.CMFPlone
  45      have_plone = 1
  46  except ImportError:
  47      have_plone = 0
  48  
  49  # test for FileSystemSite
  50  try:
  51      import Products.FileSystemSite
  52      have_fss = 1
  53  except ImportError:
  54      have_fss = 0
  55  
  56  # do the minimal stuff for skin registering
  57  # note that CMF/Plone users will still have to run the
  58  # Extensions/Install.py script
  59  if have_cmf:
  60      # Need to do this in case Archetypes isn't present.
  61      from Products.CMFCore.FSFile import FSFile
  62      from Products.CMFCore.DirectoryView import registerFileExtension, registerDirectory
  63      registerFileExtension('xsl', FSFile)
  64      registerDirectory('common', globals())
  65  
  66      if have_plone:
  67          from Products.kupu.plone import initialize
  68  
  69  elif have_zope2 and have_fss:
  70      import zope2
  71      initialize = zope2.initialize
  72  
  73  if have_zope2:
  74      # in Zope 2, make all modules in the 'python' lib available
  75      def __allow_access_to_unprotected_subobjects__(name, value=None):
  76          return name in ('python')
  77  
  78      from AccessControl import allow_module
  79      allow_module('Products.kupu.python.nationalizer')
  80      allow_module('Products.kupu.python.spellcheck')
  81  
  82  # do nothing for zope3 (all is done in zcml)


Généré le : Sun Feb 25 15:30:41 2007 par Balluche grâce à PHPXref 0.7