Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
Archetypes.ArchetypeTool.ArchetypeTool Class Reference
Inheritance diagram for Archetypes.ArchetypeTool.ArchetypeTool:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.ArchetypeTool.ArchetypeTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def manage_dumpSchema
def registerTemplate
def lookupTemplates
def listTemplates
def bindTemplate
def manage_templates
def typeImplementsInterfaces
def isTemplateEnabled
def listTemplateEnabledPortalTypes
def listPortalTypesWithInterfaces
def listRegisteredTypes
def getTypeSpec
def listTypes
def lookupType
def manage_installType
def getSearchWidgets
def getWidgets
def enum
def Content
def manage_doGenerate
 Management Forms.
def manage_inspect
def manage_reindex
def getChangedSchema
def manage_updateSchema
def manage_migrate
def listCatalogs
def manage_updateCatalogs
def setCatalogsByType
def getCatalogsByType
def getCatalogsInSite
def visibleLookup
def lookupObject
def has_graphviz

Public Attributes

 catalog_map

Static Public Attributes

 id = TOOL_NAME
tuple meta_type = TOOL_NAME.title()
 isPrincipiaFolderish = True
tuple security = ClassSecurityInfo()
tuple meta_types = all_meta_types()
tuple manage_options
tuple manage_uids = PageTemplateFile('viewContents', _www)
tuple manage_templateForm = PageTemplateFile('manageTemplates',_www)
tuple manage_debugForm = PageTemplateFile('generateDebug', _www)
tuple manage_updateSchemaForm = PageTemplateFile('updateSchemaForm', _www)
tuple manage_migrationForm = PageTemplateFile('migrationForm', _www)
tuple manage_dumpSchemaForm = PageTemplateFile('schema', _www)
tuple manage_catalogs = PageTemplateFile('manage_catalogs', _www)
 index = manage_reindex
int subtransactioncounter = 0
 getObject = lookupObject

Private Member Functions

def _rawEnum
def _listAllTypes
def _updateObject
def _updateChangedObject
def _removeSchemaAndUpdateObject
def _removeSchemaAndUpdateChangedObject

Private Attributes

 _schemas
 _templates
 _registeredTemplates
 _types
 _p_changed

Detailed Description

Archetypes tool, manage aspects of Archetype instances.

Definition at line 492 of file ArchetypeTool.py.


Constructor & Destructor Documentation

Definition at line 558 of file ArchetypeTool.py.

00558 
00559     def __init__(self):
00560         self._schemas = PersistentMapping()
00561         self._templates = PersistentMapping()
00562         self._registeredTemplates = PersistentMapping()
00563         # meta_type -> [names of CatalogTools]
00564         self.catalog_map = PersistentMapping()
00565         self.catalog_map['Reference'] = [] # References not in portal_catalog
00566         # DM (avoid persistency bug): "_types" now maps known schemas to signatures
00567         self._types = {}

Here is the caller graph for this function:


Member Function Documentation

List all types -- either currently known or known to us.

Definition at line 978 of file ArchetypeTool.py.

00978 
00979     def _listAllTypes(self):
00980         """List all types -- either currently known or known to us.
00981         """
00982         allTypes = _types.copy(); allTypes.update(self._types)
00983         return allTypes.keys()

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool._rawEnum (   self,
  callback,
  args,
  kwargs 
) [private]
Finds all object to check if they are 'referenceable'.

Definition at line 897 of file ArchetypeTool.py.

00897 
00898     def _rawEnum(self, callback, *args, **kwargs):
00899         """Finds all object to check if they are 'referenceable'.
00900         """
00901         catalog = getToolByName(self, 'portal_catalog')
00902         brains = catalog(id=[])
00903         for b in brains:
00904             o = b.getObject()
00905             if o is not None:
00906                 if IBaseObject.isImplementedBy(o):
00907                     callback(o, *args, **kwargs)
00908             else:
00909                 log('no object for brain: %s:%s' % (b,b.getURL()))
00910 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1087 of file ArchetypeTool.py.

01087 
01088     def _removeSchemaAndUpdateChangedObject(self, o, path):
01089         if not o._isSchemaCurrent():
01090             self._removeSchemaAndUpdateObject(o, path)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool._removeSchemaAndUpdateObject (   self,
  o,
  path 
) [private]

Definition at line 1084 of file ArchetypeTool.py.

01084 
01085     def _removeSchemaAndUpdateObject(self, o, path):
01086         self._updateObject(o, path, remove_instance_schemas=True)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool._updateChangedObject (   self,
  o,
  path 
) [private]

Definition at line 1080 of file ArchetypeTool.py.

01080 
01081     def _updateChangedObject(self, o, path):
01082         if not o._isSchemaCurrent():
01083             self._updateObject(o, path)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool._updateObject (   self,
  o,
  path,
  remove_instance_schemas = None 
) [private]

Definition at line 1071 of file ArchetypeTool.py.

01071 
01072     def _updateObject(self, o, path, remove_instance_schemas=None):
01073         o._updateSchema(remove_instance_schemas=remove_instance_schemas)
01074         # Subtransactions to avoid eating up RAM when used inside a
01075         # 'ZopeFindAndApply' like in manage_updateSchema
01076         self.subtransactioncounter += 1
01077         # Only every 250 objects a sub-commit, otherwise it eats up all diskspace
01078         if not self.subtransactioncounter % 250:
01079             transaction.savepoint(optimistic=True)

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.bindTemplate (   self,
  portal_type,
  templateList 
)
Creates binding between a type and its associated views.

Definition at line 636 of file ArchetypeTool.py.

00636 
00637     def bindTemplate(self, portal_type, templateList):
00638         """Creates binding between a type and its associated views.
00639         """
00640         self._templates[portal_type] = templateList

Here is the caller graph for this function:

Return a list of all the content ids.

Definition at line 924 of file ArchetypeTool.py.

00924 
00925     def Content(self):
00926         """Return a list of all the content ids.
00927         """
00928         catalog = getToolByName(self, UID_CATALOG)
00929         keys = catalog.uniqueValuesFor('UID')
00930         results = catalog(UID=keys)
00931         return results
00932 

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.enum (   self,
  callback,
  args,
  kwargs 
)

Definition at line 912 of file ArchetypeTool.py.

00912 
00913     def enum(self, callback, *args, **kwargs):
00914         catalog = getToolByName(self, UID_CATALOG)
00915         keys = catalog.uniqueValuesFor('UID')
00916         for uid in keys:
00917             o = self.getObject(uid)
00918             if o:
00919                 callback(o, *args, **kwargs)
00920             else:
00921                 log('No object for %s' % uid)
00922 

Here is the call graph for this function:

Return the catalog objects assoicated with a given type.

Definition at line 1137 of file ArchetypeTool.py.

01137 
01138     def getCatalogsByType(self, portal_type):
01139         """Return the catalog objects assoicated with a given type.
01140         """
01141         catalogs = []
01142         catalog_map = getattr(self, 'catalog_map', None)
01143         if catalog_map is not None:
01144             names = self.catalog_map.get(portal_type, ['portal_catalog'])
01145         else:
01146             names = ['portal_catalog']
01147         portal = getToolByName(self, 'portal_url').getPortalObject()
01148         for name in names:
01149             try:
01150                 catalogs.append(getToolByName(portal, name))
01151             except (ConflictError, KeyboardInterrupt):
01152                 raise
01153             except Exception, E:
01154                 log('No tool', name, E)
01155                 pass
01156         return catalogs

Here is the call graph for this function:

Return a list of ids for objects implementing ZCatalog.

Definition at line 1158 of file ArchetypeTool.py.

01158 
01159     def getCatalogsInSite(self):
01160         """Return a list of ids for objects implementing ZCatalog.
01161         """
01162         portal = getToolByName(self, 'portal_url').getPortalObject()
01163         res = []
01164         for object in portal.objectValues():
01165             if ICatalogTool.isImplementedBy(object):
01166                 res.append(object.getId())
01167                 continue
01168             if IZCatalog.isImplementedBy(object):
01169                 res.append(object.getId())
01170                 continue
01171 
01172         res.sort()
01173 
01174         return res

Here is the call graph for this function:

Returns a list of tuples indicating which schema have changed.

Tuples have the form (schema, changed).

Definition at line 986 of file ArchetypeTool.py.

00986 
00987     def getChangedSchema(self):
00988         """Returns a list of tuples indicating which schema have changed.
00989 
00990         Tuples have the form (schema, changed).
00991         """
00992         list = []
00993         currentTypes = _types
00994         ourTypes = self._types
00995         modified = False
00996         keys = self._listAllTypes()
00997         keys.sort()
00998         for t in keys:
00999             if t not in ourTypes:
01000                 # Add it
01001                 ourTypes[t] = currentTypes[t]['signature']
01002                 modified = True
01003                 list.append((t, 0))
01004             elif t not in currentTypes:
01005                 # Huh: what shall we do? We remove it -- this might be wrong!
01006                 del ourTypes[t]
01007                 modified = True
01008                 # We do not add an entry because we cannot update
01009                 # these objects (having no longer type information for them)
01010             else:
01011                 list.append((t, ourTypes[t] != currentTypes[t]['signature']))
01012         if modified:
01013             self._p_changed = True
01014         return list
01015 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.getSearchWidgets (   self,
  package = None,
  type = None,
  context = None,
  nosort = None 
)
Empty widgets for searching.

Definition at line 822 of file ArchetypeTool.py.

00822 
00823                          context=None, nosort=None):
00824         """Empty widgets for searching.
00825         """
00826         return self.getWidgets(package=package, type=type,
00827                                context=context, mode='search', nosort=nosort)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.getTypeSpec (   self,
  package,
  type 
)

Definition at line 743 of file ArchetypeTool.py.

00743 
00744     def getTypeSpec(self, package, type):
00745         t = self.lookupType(package, type)
00746         module = t['klass'].__module__
00747         klass = t['name']
00748         return '%s.%s' % (module, klass)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.getWidgets (   self,
  instance = None,
  package = None,
  type = None,
  context = None,
  mode = 'edit',
  fields = None,
  schemata = None,
  nosort = None 
)
Empty widgets for standalone rendering.

Definition at line 832 of file ArchetypeTool.py.

00832 
00833                    fields=None, schemata=None, nosort=None):
00834         """Empty widgets for standalone rendering.
00835         """
00836         widgets = []
00837         w_keys = {}
00838         context = context is not None and context or self
00839         instances = instance is not None and [instance] or []
00840         f_names = fields
00841         if not instances:
00842             for t in self.listTypes(package, type):
00843                 instance = t('fake_instance')
00844                 instance._at_is_fake_instance = True
00845                 wrapped = instance.__of__(context)
00846                 wrapped.initializeArchetype()
00847                 instances.append(wrapped)
00848         for instance in instances:
00849             if schemata is not None:
00850                 schema = instance.Schemata()[schemata].copy()
00851             else:
00852                 schema = instance.Schema().copy()
00853             fields = schema.fields()
00854             if mode == 'search':
00855                 # Include only fields which have an index
00856                 # XXX duplicate fieldnames may break this,
00857                 # as different widgets with the same name
00858                 # on different schemas means only the first
00859                 # one found will be used
00860                 indexes=self.portal_catalog.indexes()
00861                 fields = [f for f in fields
00862                           if (f.accessor and
00863                               not w_keys.has_key(f.accessor)
00864                               and f.accessor in indexes)]
00865             if f_names is not None:
00866                 fields = filter(lambda f: f.getName() in f_names, fields)
00867             for field in fields:
00868                 widget = field.widget
00869                 field_name = field.getName()
00870                 accessor = field.getAccessor(instance)
00871                 if mode == 'search':
00872                     field.required = False
00873                     field.addable = False # for ReferenceField
00874                     if not isinstance(field.vocabulary, DisplayList):
00875                         field.vocabulary = field.Vocabulary(instance)
00876                     if '' not in field.vocabulary.keys():
00877                         field.vocabulary = DisplayList([('', _(u'at_search_any', default=u'<any>'))]) + \
00878                                            field.vocabulary
00879                     widget.populate = False
00880                     field_name = field.accessor
00881                     # accessor must be a method which doesn't take an argument
00882                     # this lambda is facking an accessor
00883                     accessor = lambda: field.getDefault(instance)
00884 
00885                 w_keys[field_name] = None
00886                 widgets.append((field_name, WidgetWrapper(
00887                     field_name=field_name,
00888                     mode=mode,
00889                     widget=widget,
00890                     instance=instance,
00891                     field=field,
00892                     accessor=accessor)))
00893         if mode == 'search' and nosort == None:
00894             widgets.sort()
00895         return [widget for name, widget in widgets]

Here is the call graph for this function:

Here is the caller graph for this function:

Runtime check for graphviz, used in condition on tab.

Definition at line 1198 of file ArchetypeTool.py.

01198 
01199     def has_graphviz(self):
01200         """Runtime check for graphviz, used in condition on tab.
01201         """
01202         return HAS_GRAPHVIZ
01203 
01204 InitializeClass(ArchetypeTool)
Checks if an type uses ITemplateMixin.

Definition at line 673 of file ArchetypeTool.py.

00673 
00674     def isTemplateEnabled(self, type):
00675         """Checks if an type uses ITemplateMixin.
00676         """
00677         return self.typeImplementsInterfaces(type, [ITemplateMixin])
        

Here is the call graph for this function:

Show the catalog mapping.

Definition at line 1104 of file ArchetypeTool.py.

01104 
01105     def listCatalogs(self):
01106         """Show the catalog mapping.
01107         """
01108         return self.catalog_map

Returns a list of ftis of which the types implement one of
the given interfaces.  Only returns AT types.

Get a list of FTIs of types implementing IReferenceable:
>>> tool = getToolByName(self.portal, TOOL_NAME)
>>> meth = tool.listPortalTypesWithInterfaces
>>> ftis = tool.listPortalTypesWithInterfaces([IReferenceable])

Sort the type ids and print them:
>>> type_ids = [fti.getId() for fti in ftis]
>>> type_ids.sort()
>>> type_ids
['ATBIFolder', 'ComplexType', ...]

Definition at line 685 of file ArchetypeTool.py.

00685 
00686     def listPortalTypesWithInterfaces(self, ifaces):
00687         """Returns a list of ftis of which the types implement one of
00688         the given interfaces.  Only returns AT types.
00689 
00690         Get a list of FTIs of types implementing IReferenceable:
00691         >>> tool = getToolByName(self.portal, TOOL_NAME)
00692         >>> meth = tool.listPortalTypesWithInterfaces
00693         >>> ftis = tool.listPortalTypesWithInterfaces([IReferenceable])
00694         
00695         Sort the type ids and print them:
00696         >>> type_ids = [fti.getId() for fti in ftis]
00697         >>> type_ids.sort()
00698         >>> type_ids
00699         ['ATBIFolder', 'ComplexType', ...]
00700         """
00701         pt = getToolByName(self, 'portal_types')
00702         value = []
00703         for data in listTypes():
00704             klass = data['klass']
00705             for iface in ifaces:
00706                 if iface.isImplementedByInstancesOf(klass):
00707                     ti = pt.getTypeInfo(data['portal_type'])
00708                     if ti is not None:
00709                         value.append(ti)
00710         return value

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.listRegisteredTypes (   self,
  inProject = False,
  portalTypes = False 
)
Return the list of sorted types.

Definition at line 713 of file ArchetypeTool.py.

00713 
00714     def listRegisteredTypes(self, inProject=False, portalTypes=False):
00715         """Return the list of sorted types.
00716         """
00717 
00718         def type_sort(a, b):
00719             v = cmp(a['package'], b['package'])
00720             if v != False: return v
00721             c = cmp(a['klass'].__class__.__name__,
00722                     b['klass'].__class__.__name__)
00723 
00724             if c == False:
00725                 return cmp(a['package'], b['package'])
00726             return c
00727 
00728         values = listTypes()
00729         values.sort(type_sort)
00730 
00731         if inProject:
00732             # portal_type can change (as it does after ATCT-migration), so we
00733             # need to check against the content_meta_type of each type-info
00734             ttool = getToolByName(self, 'portal_types')
00735             types = [ti.Metatype() for ti in ttool.listTypeInfo()]
00736            if portalTypes:
00737                 values = [v for v in values if v['portal_type'] in types]
00738             else:
00739                 values = [v for v in values if v['meta_type'] in types]
00740 
00741         return values

Here is the call graph for this function:

Here is the caller graph for this function:

Return a list of portal_types with ITemplateMixin

Definition at line 679 of file ArchetypeTool.py.

00679 
00680     def listTemplateEnabledPortalTypes(self):
00681         """Return a list of portal_types with ITemplateMixin
00682         """
00683         return self.listPortalTypesWithInterfaces([ITemplateMixin])
        

Here is the call graph for this function:

Lists all the templates.

Definition at line 630 of file ArchetypeTool.py.

00630 
00631     def listTemplates(self):
00632         """Lists all the templates.
00633         """
00634         return DisplayList(self._registeredTemplates.items()).sortedByValue()

def Archetypes.ArchetypeTool.ArchetypeTool.listTypes (   self,
  package = None,
  type = None 
)
Just the class.

Definition at line 750 of file ArchetypeTool.py.

00750 
00751     def listTypes(self, package=None, type=None):
00752         """Just the class.
00753         """
00754         if type is None:
00755             return [t['klass'] for t in listTypes(package)]
00756         else:
00757             return [getType(type, package)['klass']]

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1192 of file ArchetypeTool.py.

01192 
01193     def lookupObject(self,uid):
01194         deprecated('ArchetypeTool.lookupObject is deprecated')
01195         return self.reference_catalog.lookupObject(uid)

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.lookupTemplates (   self,
  instance_or_portaltype = None 
)
Lookup templates by giving an instance or a portal_type.

Returns a DisplayList.

Definition at line 607 of file ArchetypeTool.py.

00607 
00608     def lookupTemplates(self, instance_or_portaltype=None):
00609         """Lookup templates by giving an instance or a portal_type.
00610 
00611         Returns a DisplayList.
00612         """
00613         results = []
00614         if not isinstance(instance_or_portaltype, basestring):
00615             portal_type = instance_or_portaltype.getTypeInfo().getId()
00616         else:
00617             portal_type = instance_or_portaltype
00618         try:
00619             templates = self._templates[portal_type]
00620         except KeyError:
00621             return DisplayList()
00622             # XXX Look this up in the types tool later
00623             # self._templates[instance] = ['base_view',]
00624             # templates = self._templates[instance]
00625         for t in templates:
00626             results.append((t, self._registeredTemplates[t]))            
00627 
00628         return DisplayList(results).sortedByValue()

def Archetypes.ArchetypeTool.ArchetypeTool.lookupType (   self,
  package,
  type 
)

Definition at line 759 of file ArchetypeTool.py.

00759 
00760     def lookupType(self, package, type):
00761         types = self.listRegisteredTypes()
00762         for t in types:
00763             if t['package'] != package:
00764                 continue
00765             if t['meta_type'] == type:
00766                 # We have to return the schema wrapped into the acquisition of
00767                 # something to allow access. Otherwise we will end up with:
00768                 # Your user account is defined outside the context of the object
00769                 # being accessed.
00770                 t['schema'] = ImplicitAcquisitionWrapper(t['schema'], self)
00771                 return t
00772         return None

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_doGenerate (   self,
  sids = (),
  REQUEST = None 
)

Management Forms.

(Re)generate types.

Definition at line 936 of file ArchetypeTool.py.

00936 
00937     def manage_doGenerate(self, sids=(), REQUEST=None):
00938         """(Re)generate types.
00939         """
00940         schemas = []
00941         for sid in sids:
00942             schemas.append(self.getSchema(sid))
00943 
00944         for s in schemas:
00945             s.generate()
00946 
00947         if REQUEST:
00948             return REQUEST.RESPONSE.redirect(self.absolute_url() +
00949                                              '/manage_workspace')

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_dumpSchema (   self,
  REQUEST = None 
)
XML Dump Schema of passed in class.

Definition at line 570 of file ArchetypeTool.py.

00570 
00571     def manage_dumpSchema(self, REQUEST=None):
00572         """XML Dump Schema of passed in class.
00573         """
00574         from Products.Archetypes.Schema import getSchemata
00575         package = REQUEST.get('package', '')
00576         type_name = REQUEST.get('type_name', '')
00577         spec = self.getTypeSpec(package, type_name)
00578         type = self.lookupType(package, type_name)
00579         options = {}
00580         options['classname'] = spec
00581         options['schematas'] = getSchemata(type['klass'])
00582         REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml')
00583         return self.manage_dumpSchemaForm(**options)

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_inspect (   self,
  UID,
  REQUEST = None 
)
Dump some things about an object hook in the debugger for now.

Definition at line 952 of file ArchetypeTool.py.

00952 
00953     def manage_inspect(self, UID, REQUEST=None):
00954         """Dump some things about an object hook in the debugger for now.
00955         """
00956         object = self.getObject(UID)
00957         log(object, object.Schema(), dir(object))
00958 
00959         return REQUEST.RESPONSE.redirect(self.absolute_url() +
00960                                          '/manage_uids')

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_installType (   self,
  typeName,
  package = None,
  uninstall = None,
  REQUEST = None 
)
Un/Install a type TTW.

Definition at line 776 of file ArchetypeTool.py.

00776 
00777                            uninstall=None, REQUEST=None):
00778         """Un/Install a type TTW.
00779         """
00780         typesTool = getToolByName(self, 'portal_types')
00781         try:
00782             typesTool._delObject(typeName)
00783         except (ConflictError, KeyboardInterrupt):
00784             raise
00785         except: # XXX bare exception
00786             pass
00787         if uninstall is not None:
00788             if REQUEST:
00789                 return REQUEST.RESPONSE.redirect(self.absolute_url() +
00790                                                  '/manage_debugForm')
00791             return
00792 
00793         typeinfo_name = '%s: %s' % (package, typeName)
00794 
00795         # We want to run the process/modify_fti code which might not
00796         # have been called
00797         typeDesc = getType(typeName, package)
00798         process_types([typeDesc], package)
00799         klass = typeDesc['klass']
00800         
00801         # get the meta type of the FTI from the class, use the default FTI as default
00802         fti_meta_type = getattr(klass, '_at_fti_meta_type', None)
00803         if fti_meta_type in (None, 'simple item'):
00804             fti_meta_type = FactoryTypeInformation.meta_type
00805 
00806         typesTool.manage_addTypeInformation(fti_meta_type,
00807                                             id=typeName,
00808                                             typeinfo_name=typeinfo_name)
00809         t = getattr(typesTool, typeName, None)
00810         if t:
00811             t.title = getattr(klass, 'archetype_name',
00812                               typeDesc['portal_type'])
00813 
00814         # and update the actions as needed
00815         fixActionsForType(klass, typesTool)
00816 
00817         if REQUEST:
00818             return REQUEST.RESPONSE.redirect(self.absolute_url() +
00819                                              '/manage_debugForm')

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_migrate (   self,
  REQUEST = None 
)
Run Extensions.migrations.migrate.

Definition at line 1093 of file ArchetypeTool.py.

01093 
01094     def manage_migrate(self, REQUEST=None):
01095         """Run Extensions.migrations.migrate.
01096         """
01097         from Products.Archetypes.Extensions.migrations import migrate
01098         out = migrate(self)
01099         self.manage_updateSchema()
01100         return out

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_reindex (   self,
  REQUEST = None 
)
Assign UIDs to all basecontent objects.

Definition at line 963 of file ArchetypeTool.py.

00963 
00964     def manage_reindex(self, REQUEST=None):
00965         """Assign UIDs to all basecontent objects.
00966         """
00967 
00968         def _index(object, archetype_tool):
00969             archetype_tool.registerContent(object)
00970 
00971         self._rawEnum(_index, self)
00972 
00973         return REQUEST.RESPONSE.redirect(self.absolute_url() +
00974                                          '/manage_uids')

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_templates (   self,
  REQUEST = None 
)
Sets all the template/type mappings.

Definition at line 643 of file ArchetypeTool.py.

00643 
00644     def manage_templates(self, REQUEST=None):
00645         """Sets all the template/type mappings.
00646         """
00647         prefix = 'template_names_'
00648         for key in REQUEST.form.keys():
00649             if key.startswith(prefix):
00650                 k = key[len(prefix):]
00651                 v = REQUEST.form.get(key)
00652                 self.bindTemplate(k, v)
00653 
00654         add = REQUEST.get('addTemplate')
00655         name = REQUEST.get('newTemplate')
00656         if add and name:
00657             self.registerTemplate(name)
00658 
00659         return REQUEST.RESPONSE.redirect(self.absolute_url() + '/manage_templateForm')
    

Here is the call graph for this function:

Set the catalog map for meta_type to include the list
catalog_names.

Definition at line 1111 of file ArchetypeTool.py.

01111 
01112     def manage_updateCatalogs(self, REQUEST=None):
01113         """Set the catalog map for meta_type to include the list
01114         catalog_names.
01115         """
01116         prefix = 'catalog_names_'
01117         for key in REQUEST.form.keys():
01118             if key.startswith(prefix):
01119                 k = key[len(prefix):]
01120                 v = REQUEST.form.get(key)
01121                 self.setCatalogsByType(k, v)
01122 
01123         return REQUEST.RESPONSE.redirect(self.absolute_url() +
01124                                          '/manage_catalogs')

Here is the call graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.manage_updateSchema (   self,
  REQUEST = None,
  update_all = None,
  remove_instance_schemas = None 
)
Make sure all objects' schema are up to date.

Definition at line 1019 of file ArchetypeTool.py.

01019 
01020                             remove_instance_schemas=None):
01021         """Make sure all objects' schema are up to date.
01022         """
01023         out = StringIO()
01024         print >> out, 'Updating schema...'
01025 
01026         update_types = []
01027         if REQUEST is None:
01028             # DM (avoid persistency bug): avoid code duplication
01029             update_types = [ti[0] for ti in self.getChangedSchema() if ti[1]]
01030         else:
01031             # DM (avoid persistency bug):
01032             for t in self._listAllTypes():
01033                 if REQUEST.form.get(t, False):
01034                     update_types.append(t)
01035             update_all = REQUEST.form.get('update_all', False)
01036             remove_instance_schemas = REQUEST.form.get(
01037                 'remove_instance_schemas', False)
01038 
01039         # XXX: Enter this block only when there are types to update!
01040         if update_types:
01041             # Use the catalog's ZopeFindAndApply method to walk through
01042             # all objects in the portal.  This works much better than
01043             # relying on the catalog to find objects, because an object
01044             # may be uncatalogable because of its schema, and then you
01045             # can't update it if you require that it be in the catalog.
01046             catalog = getToolByName(self, 'portal_catalog')
01047             portal = getToolByName(self, 'portal_url').getPortalObject()
01048             meta_types = [_types[t]['meta_type'] for t in update_types]
01049             if remove_instance_schemas:
01050                 func_update_changed = self._removeSchemaAndUpdateChangedObject
01051                 func_update_all = self._removeSchemaAndUpdateObject
01052             else:
01053                 func_update_changed = self._updateChangedObject
01054                 func_update_all = self._updateObject
01055             if update_all:
01056                 catalog.ZopeFindAndApply(portal, obj_metatypes=meta_types,
01057                     search_sub=True, apply_func=func_update_all)
01058             else:
01059                 catalog.ZopeFindAndApply(portal, obj_metatypes=meta_types,
01060                     search_sub=True, apply_func=func_update_changed)
01061             for t in update_types:
01062                 self._types[t] = _types[t]['signature']
01063             self._p_changed = True
01064 
01065         print >> out, 'Done.'
01066         return out.getvalue()

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.registerTemplate (   self,
  template,
  name = None 
)

Definition at line 594 of file ArchetypeTool.py.

00594 
00595     def registerTemplate(self, template, name=None):
00596         # Lookup the template by name
00597         if not name:
00598             obj = self.unrestrictedTraverse(template, None)
00599             try:
00600                 name = obj.title_or_id()
00601             except:
00602                 name = template
00603 
00604         self._registeredTemplates[template] = name
00605 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.setCatalogsByType (   self,
  portal_type,
  catalogList 
)
associate catalogList with meta_type. (unfortunally not portal_type).

    catalogList is a list of strings with the ids of the catalogs.
    Each catalog is has to be a tool, means unique in site root.

Definition at line 1127 of file ArchetypeTool.py.

01127 
01128     def setCatalogsByType(self, portal_type, catalogList):
01129         """ associate catalogList with meta_type. (unfortunally not portal_type).
01130         
01131             catalogList is a list of strings with the ids of the catalogs.
01132             Each catalog is has to be a tool, means unique in site root.
01133         """
01134         self.catalog_map[portal_type] = catalogList
01135 

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.typeImplementsInterfaces (   self,
  type,
  interfaces 
)
Checks if an type uses one of the given interfaces.

Definition at line 661 of file ArchetypeTool.py.

00661 
00662     def typeImplementsInterfaces(self, type, interfaces):
00663         """Checks if an type uses one of the given interfaces.
00664         """
00665         if isinstance(type, dict) and type.has_key('klass'):
00666             type = type['klass']
00667         for iface in interfaces:
00668             res = iface.isImplementedByInstancesOf(type)
00669             if res:
00670                 return True
00671         return False
    

Here is the caller graph for this function:

def Archetypes.ArchetypeTool.ArchetypeTool.visibleLookup (   self,
  field,
  vis_key,
  vis_value = 'visible' 
)
Checks the value of a specific key in the field widget's
'visible' dictionary.

Returns True or False so it can be used within a lambda as
the predicate for a filterFields call.

Definition at line 1176 of file ArchetypeTool.py.

01176 
01177     def visibleLookup(self, field, vis_key, vis_value='visible'):
01178         """Checks the value of a specific key in the field widget's
01179         'visible' dictionary.
01180 
01181         Returns True or False so it can be used within a lambda as
01182         the predicate for a filterFields call.
01183         """
01184         vis_dict = field.widget.visible
01185         value = ''
01186         if vis_dict.has_key(vis_key):
01187             value = field.widget.visible[vis_key]
01188         if value == vis_value:
01189             return True
01190         else:
01191             return False


Member Data Documentation

Definition at line 1012 of file ArchetypeTool.py.

Definition at line 561 of file ArchetypeTool.py.

Definition at line 559 of file ArchetypeTool.py.

Definition at line 560 of file ArchetypeTool.py.

Definition at line 566 of file ArchetypeTool.py.

Definition at line 563 of file ArchetypeTool.py.

Definition at line 1196 of file ArchetypeTool.py.

Definition at line 495 of file ArchetypeTool.py.

Definition at line 976 of file ArchetypeTool.py.

Definition at line 500 of file ArchetypeTool.py.

Definition at line 555 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_debugForm = PageTemplateFile('generateDebug', _www) [static]

Definition at line 543 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_dumpSchemaForm = PageTemplateFile('schema', _www) [static]

Definition at line 552 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_migrationForm = PageTemplateFile('migrationForm', _www) [static]

Definition at line 549 of file ArchetypeTool.py.

Initial value:
(
        (
        { 'label'  : 'Types',
          'action' : 'manage_debugForm',
          },

        {  'label'  : 'Catalogs',
           'action' : 'manage_catalogs',
           },

        { 'label'  : 'Templates',
          'action' : 'manage_templateForm',
          },

        {  'label'  : 'UIDs',
           'action' : 'manage_uids',
           },

        { 'label'  : 'Update Schema',
          'action' : 'manage_updateSchemaForm',
          },

        { 'label'  : 'Migration',
          'action' : 'manage_migrationForm',
          },

        ) + SQLStorageConfig.manage_options
        )

Definition at line 506 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_templateForm = PageTemplateFile('manageTemplates',_www) [static]

Definition at line 540 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_uids = PageTemplateFile('viewContents', _www) [static]

Definition at line 537 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.manage_updateSchemaForm = PageTemplateFile('updateSchemaForm', _www) [static]

Definition at line 546 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.meta_type = TOOL_NAME.title() [static]

Definition at line 496 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.meta_types = all_meta_types() [static]

Definition at line 504 of file ArchetypeTool.py.

tuple Archetypes.ArchetypeTool.ArchetypeTool.security = ClassSecurityInfo() [static]

Definition at line 502 of file ArchetypeTool.py.

Definition at line 1069 of file ArchetypeTool.py.


The documentation for this class was generated from the following file: