Back to index

plone3  3.1.7
Functions
Archetypes.setuphandlers Namespace Reference

Functions

def install_uidcatalog
def install_referenceCatalog
def install_templates
def setupArchetypes

Detailed Description

Archetypes setup handlers.

Function Documentation

def Archetypes.setuphandlers.install_referenceCatalog (   out,
  site,
  rebuild = False 
)

Definition at line 32 of file setuphandlers.py.

00032 
00033 def install_referenceCatalog(out, site, rebuild=False):
00034     catalog = getToolByName(site, REFERENCE_CATALOG)
00035     reindex = False
00036 
00037     for indexName, indexType in (('UID', 'FieldIndex'),
00038                                  ('sourceUID', 'FieldIndex'),
00039                                  ('targetUID', 'FieldIndex'),
00040                                  ('relationship', 'FieldIndex'),
00041                                  ('targetId', 'FieldIndex'),):
00042         if not indexName in catalog.indexes():
00043             catalog.addIndex(indexName, indexType, extra=None)
00044             reindex = True
00045         if not indexName in catalog.schema():
00046             catalog.addColumn(indexName)
00047             reindex = True
00048     if reindex:
00049         catalog.manage_reindexIndex()
00050 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.setuphandlers.install_templates (   out,
  site 
)

Definition at line 51 of file setuphandlers.py.

00051 
00052 def install_templates(out, site):
00053     at = getToolByName(site, TOOL_NAME)
00054     at.registerTemplate('base_view', 'Base View')
00055 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.setuphandlers.install_uidcatalog (   out,
  site,
  rebuild = False 
)

Definition at line 8 of file setuphandlers.py.

00008 
00009 def install_uidcatalog(out, site, rebuild=False):
00010     catalog = getToolByName(site, UID_CATALOG)
00011 
00012     index_defs= (('UID', 'FieldIndex'),
00013                  ('Type', 'FieldIndex'),
00014                  ('id', 'FieldIndex'),
00015                  ('Title', 'FieldIndex'), # used for sorting
00016                  ('portal_type', 'FieldIndex'),)
00017     metadata_defs = ('UID', 'Type', 'id', 'Title', 'portal_type', 'meta_type')
00018     reindex = False
00019 
00020     for indexName, indexType in index_defs:
00021         if indexName not in catalog.indexes():
00022             catalog.addIndex(indexName, indexType, extra=None)
00023             reindex = True
00024 
00025     for metadata in metadata_defs:
00026         if not indexName in catalog.schema():
00027             catalog.addColumn(metadata)
00028             reindex = True
00029     if reindex:
00030         catalog.manage_reindexIndex()
00031 

Here is the call graph for this function:

Here is the caller graph for this function:

Setup Archetypes step.

Definition at line 56 of file setuphandlers.py.

00056 
00057 def setupArchetypes(context):
00058     """
00059     Setup Archetypes step.
00060     """
00061     # Only run step if a flag file is present (e.g. not an extension profile)
00062     if context.readDataFile('archetypes-various.txt') is None:
00063         return
00064     out = []
00065     site = context.getSite()
00066     install_uidcatalog(out, site)
00067     install_referenceCatalog(out, site)
00068     install_templates(out, site)

Here is the call graph for this function: