Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
CMFCore.browser.typeinfo.FactoryTypeInformationAddView Class Reference
Inheritance diagram for CMFCore.browser.typeinfo.FactoryTypeInformationAddView:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.browser.typeinfo.FactoryTypeInformationAddView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def getProfileInfos

Static Public Attributes

 klass = FactoryTypeInformation
string description = u'A type information object defines a portal type.'

Private Member Functions

def _initSettings

Detailed Description

Add view for FactoryTypeInformation.

Definition at line 30 of file typeinfo.py.


Member Function Documentation

def CMFCore.browser.typeinfo.FactoryTypeInformationAddView._initSettings (   self,
  obj,
  profile_id,
  obj_path 
) [private]

Definition at line 71 of file typeinfo.py.

00071 
00072     def _initSettings(self, obj, profile_id, obj_path):
00073         stool = queryUtility(ISetupTool)
00074         if stool is None:
00075             return
00076 
00077         context = stool._getImportContext(profile_id)
00078         file_ids = context.listDirectory('types')
00079         for file_id in file_ids or ():
00080             if not file_id.endswith('.xml'):
00081                 continue
00082 
00083             filename = 'types/%s' % file_id
00084             body = context.readDataFile(filename)
00085             if body is None:
00086                 continue
00087 
00088             root = parseString(body).documentElement
00089             new_id = str(root.getAttribute('name'))
00090             if new_id != obj_path[0]:
00091                 continue
00092 
00093             meta_type = str(root.getAttribute('meta_type'))
00094             if meta_type != self.klass.meta_type:
00095                 continue
00096 
00097             importer = queryMultiAdapter((obj, context), IBody)
00098             if importer is None:
00099                 continue
00100 
00101             importer.body = body
00102             return
00103 

Here is the caller graph for this function:

Definition at line 39 of file typeinfo.py.

00039 
00040     def getProfileInfos(self):
00041         profiles = []
00042         stool = queryUtility(ISetupTool)
00043         if stool:
00044             for info in stool.listContextInfos():
00045                 obj_ids = []
00046                 context = stool._getImportContext(info['id'])
00047                 file_ids = context.listDirectory('types')
00048                 for file_id in file_ids or ():
00049                     if not file_id.endswith('.xml'):
00050                         continue
00051 
00052                     filename = 'types/%s' % file_id
00053                     body = context.readDataFile(filename)
00054                     if body is None:
00055                         continue
00056 
00057                     root = parseString(body).documentElement
00058                     meta_type = str(root.getAttribute('meta_type'))
00059                     if meta_type != self.klass.meta_type:
00060                         continue
00061 
00062                     obj_id = str(root.getAttribute('name'))
00063                     obj_ids.append(obj_id)
00064                 if not obj_ids:
00065                     continue
00066                 obj_ids.sort()
00067                 profiles.append({'id': info['id'],
00068                                  'title': info['title'],
00069                                  'obj_ids': tuple(obj_ids)})
00070         return tuple(profiles)


Member Data Documentation

string CMFCore.browser.typeinfo.FactoryTypeInformationAddView.description = u'A type information object defines a portal type.' [static]

Definition at line 37 of file typeinfo.py.

Reimplemented in CMFCore.browser.typeinfo.ScriptableTypeInformationAddView.

Definition at line 35 of file typeinfo.py.


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