Back to index

plone3  3.1.7
Functions
CMFPlone.Extensions.setupSite Namespace Reference

Functions

def process

Function Documentation

def CMFPlone.Extensions.setupSite.process (   name,
  swhome,
  ihome 
)

Definition at line 4 of file setupSite.py.

00004 
00005 def process(name, swhome, ihome):
00006     admin_username = name
00007     os.environ['INSTANCE_HOME'] = ihome
00008 
00009     if sys.platform == 'win32':
00010         sys.path.insert(0, os.path.join(swhome, 'Zope', 'lib', 'python'))
00011         sys.path.insert(1, os.path.join(swhome, 'Python', 'lib'))
00012         sys.path.insert(2, swhome)
00013     else:
00014         os.environ['SOFTWARE_HOME'] = swhome
00015         sys.path.insert(0, swhome)
00016 
00017     # have to set up env first
00018     try:
00019         # Zope 2.8 on, Zope is now 'Zope2' and 'zope' is the Zope 3
00020         # libs.
00021         import Zope2 as Zope
00022     except ImportError:
00023         import Zope
00024 
00025     configfile = os.path.join(ihome, 'etc', 'zope.conf')
00026 
00027     # nuke remaining command line arguments
00028     sys.argv = sys.argv[:1]
00029 
00030     # for 2.7 run configure
00031     Zope.configure(configfile)
00032     app = Zope.app()
00033 
00034     from Testing import makerequest
00035     app = makerequest.makerequest(app)
00036 
00037     from Products.CMFPlone.PloneInitialize import create
00038     out = create(app, admin_username)
00039     return out