Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.utils.ToolInit Class Reference

List of all members.

Public Member Functions

def getProductContext
def getPack
def getIcon
def initialize

Detailed Description

Definition at line 309 of file utils.py.


Member Function Documentation

def CMFPlone.utils.ToolInit.getIcon (   self,
  context,
  path 
)

Definition at line 319 of file utils.py.

00319 
00320     def getIcon(self, context, path):
00321         pack = self.getPack(context)
00322         icon = None
00323         # This variable is just used for the log message
00324         icon_path = path
00325         try:
00326             icon = Globals.ImageFile(path, pack.__dict__)
00327         except (IOError, OSError):
00328             # Fallback:
00329             # Assume path is relative to CMFPlone directory
00330             path = abspath(join(PACKAGE_HOME, path))
00331             try:
00332                 icon = Globals.ImageFile(path, pack.__dict__)
00333             except (IOError, OSError):
00334                 # if there is some problem loading the fancy image
00335                 # from the tool then  tell someone about it
00336                 log(('The icon for the product: %s which was set to: %s, '
00337                      'was not found. Using the default.' %
00338                      (self.product_name, icon_path)))
00339         return icon

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.utils.ToolInit.getPack (   self,
  context 
)

Definition at line 315 of file utils.py.

00315 
00316     def getPack(self, context):
00317         name = '_ProductContext__pack'
00318         return getattr(context, name, getattr(context, '__pack__', None))

Here is the caller graph for this function:

def CMFPlone.utils.ToolInit.getProductContext (   self,
  context 
)

Definition at line 311 of file utils.py.

00311 
00312     def getProductContext(self, context):
00313         name = '_ProductContext__prod'
00314         return getattr(context, name, getattr(context, '__prod', None))

Here is the caller graph for this function:

def CMFPlone.utils.ToolInit.initialize (   self,
  context 
)
Wrap the CMFCore Tool Init method 

Definition at line 340 of file utils.py.

00340 
00341     def initialize(self, context):
00342         """ Wrap the CMFCore Tool Init method """
00343         CMFCoreToolInit.initialize(self, context)
00344         for tool in self.tools:
00345             # Get the icon path from the tool
00346             path = getattr(tool, 'toolicon', None)
00347             if path is not None:
00348                 pc = self.getProductContext(context)
00349                 if pc is not None:
00350                     pid = pc.id
00351                     name = split(path)[1]
00352                     icon = self.getIcon(context, path)
00353                     if icon is None:
00354                         # Icon was not found
00355                         return
00356                     icon.__roles__ = None
00357                     tool.icon = 'misc_/%s/%s' % (self.product_name, name)
00358                     misc = OFS.misc_.misc_
00359                     Misc = OFS.misc_.Misc_
00360                     if not hasattr(misc, pid):
00361                         setattr(misc, pid, Misc(pid, {}))
00362                     getattr(misc, pid)[name] = icon
00363 

Here is the call graph for this function:


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