Back to index

plone3  3.1.7
Classes | Functions | Variables
CMFPlone.factory Namespace Reference

Classes

class  HiddenProfiles

Functions

def addPloneSiteForm
def addPloneSite

Variables

string _TOOL_ID = 'portal_setup'
string _DEFAULT_PROFILE = 'Products.CMFPlone:plone'

Function Documentation

def CMFPlone.factory.addPloneSite (   dispatcher,
  id,
  title = '',
  description = '',
  create_userfolder = 1,
  email_from_address = '',
  email_from_name = '',
  validate_email = 0,
  profile_id = _DEFAULT_PROFILE,
  snapshot = False,
  RESPONSE = None,
  extension_ids = () 
)
Add a PloneSite to 'dispatcher', configured according to 'profile_id'.

Definition at line 74 of file factory.py.

00074 
00075                  RESPONSE=None, extension_ids=()):
00076     """ Add a PloneSite to 'dispatcher', configured according to 'profile_id'.
00077     """
00078     site = PloneSite(id)
00079     dispatcher._setObject(id, site)
00080     site = dispatcher._getOb(id)
00081 
00082     site._setObject(_TOOL_ID, SetupTool(_TOOL_ID))
00083     setup_tool = getattr(site, _TOOL_ID)
00084 
00085     setup_tool.setBaselineContext('profile-%s' % profile_id)
00086     setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id)
00087     for extension_id in extension_ids:
00088         setup_tool.runAllImportStepsFromProfile('profile-%s' % extension_id)
00089 
00090     props = {}
00091     prop_keys = ['title', 'description', 'email_from_address',
00092                  'email_from_name', 'validate_email']
00093     loc_dict = locals()
00094     for key in prop_keys:
00095         if loc_dict[key]:
00096             props[key] = loc_dict[key]
00097     if props:
00098         site.manage_changeProperties(**props)
00099 
00100     if snapshot is True:
00101         setup_tool.createSnapshot('initial_configuration')
00102 
00103     if RESPONSE is not None:
00104         RESPONSE.redirect('%s/manage_main?update_menu=1'
00105                          % dispatcher.absolute_url())

Here is the caller graph for this function:

def CMFPlone.factory.addPloneSiteForm (   dispatcher)
Wrap the PTF in 'dispatcher'.

Definition at line 40 of file factory.py.

00040 
00041 def addPloneSiteForm(dispatcher):
00042     """
00043     Wrap the PTF in 'dispatcher'.
00044     """
00045     wrapped = PageTemplateFile('addSite', WWW_DIR).__of__(dispatcher)
00046 
00047     base_profiles = []
00048     extension_profiles = []
00049     not_installable = []
00050 
00051     utils = getAllUtilitiesRegisteredFor(INonInstallable)
00052     for util in utils:
00053         not_installable.extend(util.getNonInstallableProfiles())
00054 
00055     for info in profile_registry.listProfileInfo():
00056         if info.get('type') == EXTENSION and \
00057            info.get('for') in (IPloneSiteRoot, None):
00058             if info.get('id') not in not_installable:
00059                 extension_profiles.append(info)
00060 
00061     for info in profile_registry.listProfileInfo():
00062         if info.get('type') == BASE and \
00063            info.get('for') in (IPloneSiteRoot, None):
00064             if info.get('id') not in not_installable:
00065                 base_profiles.append(info)
00066 
00067     return wrapped(base_profiles=tuple(base_profiles),
00068                    extension_profiles=tuple(extension_profiles),
00069                    default_profile=_DEFAULT_PROFILE)

Here is the call graph for this function:


Variable Documentation

string CMFPlone.factory._DEFAULT_PROFILE = 'Products.CMFPlone:plone'

Definition at line 16 of file factory.py.

string CMFPlone.factory._TOOL_ID = 'portal_setup'

Definition at line 15 of file factory.py.