Back to index

plone3  3.1.7
Classes | Functions | Variables
PloneTestCase.setup Namespace Reference

Classes

class  SiteSetup
class  SiteCleanup

Functions

def setupPloneSite
def cleanupPloneSite
def _placefulSetUpHandler
def _placefulSetUp
def _placefulTearDown
def _createHomeFolder
def _optimize

Variables

int PLONE21 = 0
int PLONE25 = 0
int PLONE30 = 0
int PLONE31 = 0
int PLONE40 = 0
int USELAYER = 0
int Z3INTERFACES = 0
string portal_name = 'plone'
string portal_owner = 'portal_owner'
string default_policy = 'Default Plone'
tuple default_products = ()
 default_user = ZopeTestCase.user_name
 default_password = ZopeTestCase.user_password
string default_base_profile = 'CMFPlone:plone'
tuple default_extension_profiles = ()
tuple setupPloneSite = layer.onsetup(setupPloneSite)
tuple cleanupPloneSite = layer.onteardown(cleanupPloneSite)
 text

Function Documentation

def PloneTestCase.setup._createHomeFolder (   portal,
  member_id,
  take_ownership = 1 
) [private]
Creates a memberarea if it does not already exist.

Definition at line 407 of file setup.py.

00407 
00408 def _createHomeFolder(portal, member_id, take_ownership=1):
00409     '''Creates a memberarea if it does not already exist.'''
00410     pm = portal.portal_membership
00411     members = pm.getMembersFolder()
00412 
00413     if not hasattr(aq_base(members), member_id):
00414         # Create home folder
00415         _createObjectByType('Folder', members, id=member_id)
00416         if not PLONE21:
00417             # Create personal folder
00418             home = pm.getHomeFolder(member_id)
00419             _createObjectByType('Folder', home, id=pm.personal_id)
00420             # Uncatalog personal folder
00421             personal = pm.getPersonalFolder(member_id)
00422             personal.unindexObject()
00423 
00424     if take_ownership:
00425         user = portal.acl_users.getUserById(member_id)
00426         if user is None:
00427             raise ValueError, 'Member %s does not exist' % member_id
00428         if not hasattr(user, 'aq_base'):
00429             user = user.__of__(portal.acl_users)
00430         # Take ownership of home folder
00431         home = pm.getHomeFolder(member_id)
00432         home.changeOwnership(user)
00433         home.__ac_local_roles__ = None
00434         home.manage_setLocalRoles(member_id, ['Owner'])
00435         if not PLONE21:
00436             # Take ownership of personal folder
00437             personal = pm.getPersonalFolder(member_id)
00438             personal.changeOwnership(user)
00439             personal.__ac_local_roles__ = None
00440             personal.manage_setLocalRoles(member_id, ['Owner'])
00441 

Here is the call graph for this function:

Here is the caller graph for this function:

def PloneTestCase.setup._optimize ( ) [private]
Significantly reduces portal creation time.

Definition at line 442 of file setup.py.

00442 
00443 def _optimize():
00444     '''Significantly reduces portal creation time.'''
00445     # Don't compile expressions on creation
00446     def __init__(self, text):
00447         self.text = text
00448     from Products.CMFCore.Expression import Expression
00449     Expression.__init__ = __init__
00450     # Don't clone actions but convert to list only
00451     def _cloneActions(self):
00452         return list(self._actions)
00453     from Products.CMFCore.ActionProviderBase import ActionProviderBase
00454     ActionProviderBase._cloneActions = _cloneActions
00455     # The site creation code is not needed anymore in Plone >= 2.5
00456     # as it is now based on GenericSetup
00457     if not PLONE25:
00458         # Don't setup default directory views
00459         def setupDefaultSkins(self, p):
00460             from Products.CMFCore.utils import getToolByName
00461             ps = getToolByName(p, 'portal_skins')
00462             ps.manage_addFolder(id='custom')
00463             ps.addSkinSelection('Basic', 'custom')
00464         from Products.CMFPlone.Portal import PloneGenerator
00465         PloneGenerator.setupDefaultSkins = setupDefaultSkins
00466         # Don't setup default Members folder
00467         def setupMembersFolder(self, p):
00468             pass
00469         PloneGenerator.setupMembersFolder = setupMembersFolder
00470         # Don't setup Plone content (besides Members folder)
00471         def setupPortalContent(self, p):
00472             _createObjectByType('Large Plone Folder', p, id='Members', title='Members')
00473             if not PLONE21:
00474                 p.Members.unindexObject()
00475         PloneGenerator.setupPortalContent = setupPortalContent
00476     # Don't populate type fields in the ConstrainTypesMixin schema
00477     if PLONE21:
00478         def _ct_defaultAddableTypeIds(self):
00479             return []
00480         from Products.ATContentTypes.lib.constraintypes import ConstrainTypesMixin
00481         ConstrainTypesMixin._ct_defaultAddableTypeIds = _ct_defaultAddableTypeIds
00482 

Here is the call graph for this function:

def PloneTestCase.setup._placefulSetUp (   portal) [private]
Sets the local site/manager.

Definition at line 393 of file setup.py.

00393 
00394 def _placefulSetUp(portal):
00395     '''Sets the local site/manager.'''
00396     from zope.app.component.hooks import setHooks, setSite
00397     setHooks()
00398     setSite(portal)
00399 

Here is the caller graph for this function:

def PloneTestCase.setup._placefulSetUpHandler (   event) [private]
Subscriber for ISiteManagerCreatedEvent.
   Sets the local site/manager.

Definition at line 385 of file setup.py.

00385 
00386 def _placefulSetUpHandler(event):
00387     '''Subscriber for ISiteManagerCreatedEvent.
00388        Sets the local site/manager.
00389     '''
00390     portal = event.object
00391     _placefulSetUp(portal)
00392 

Here is the call graph for this function:

Resets the local site/manager.

Definition at line 400 of file setup.py.

00400 
00401 def _placefulTearDown():
00402     '''Resets the local site/manager.'''
00403     from zope.app.component.hooks import resetHooks, setSite
00404     resetHooks()
00405     setSite()
00406 

Removes a site.

Definition at line 174 of file setup.py.

00174 
00175 def cleanupPloneSite(id):
00176     '''Removes a site.'''
00177     SiteCleanup(id).run()

Here is the call graph for this function:

def PloneTestCase.setup.setupPloneSite (   id = portal_name,
  policy = default_policy,
  products = default_products,
  quiet = 0,
  with_default_memberarea = 1,
  base_profile = default_base_profile,
  extension_profiles = default_extension_profiles 
)
Creates a Plone site and/or quickinstalls products into it.

Definition at line 161 of file setup.py.

00161 
00162                    extension_profiles=default_extension_profiles):
00163     '''Creates a Plone site and/or quickinstalls products into it.'''
00164     if USELAYER:
00165         quiet = 1
00166         cleanupPloneSite(id)
00167     SiteSetup(id, policy, products, quiet, with_default_memberarea,
00168               base_profile, extension_profiles).run()

Here is the call graph for this function:


Variable Documentation

Definition at line 180 of file setup.py.

string PloneTestCase.setup.default_base_profile = 'CMFPlone:plone'

Definition at line 148 of file setup.py.

Definition at line 149 of file setup.py.

PloneTestCase.setup.default_password = ZopeTestCase.user_password

Definition at line 146 of file setup.py.

string PloneTestCase.setup.default_policy = 'Default Plone'

Definition at line 143 of file setup.py.

Definition at line 144 of file setup.py.

PloneTestCase.setup.default_user = ZopeTestCase.user_name

Definition at line 145 of file setup.py.

Definition at line 26 of file setup.py.

Definition at line 34 of file setup.py.

Definition at line 43 of file setup.py.

Definition at line 53 of file setup.py.

Definition at line 64 of file setup.py.

Definition at line 141 of file setup.py.

Definition at line 142 of file setup.py.

Definition at line 171 of file setup.py.

Definition at line 446 of file setup.py.

Definition at line 112 of file setup.py.

Definition at line 120 of file setup.py.