Back to index

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

List of all members.

Public Member Functions

def __init__
def convert
def name
def manage_beforeDelete
def manage_addObject
def manage_delObjects
def move_object_to_position
def move_object_up
def move_object_down
def reload
def listAddableObjectIds
def objectIds
def objectValues

Public Attributes

 id
 description
 inputs
 output

Static Public Attributes

string module = 'N/A'
string meta_type = 'TransformsChain'
tuple meta_types = all_meta_types()
tuple manage_options
tuple manage_main = PageTemplateFile('editTransformsChain', _www)
tuple manage_reloadTransform = PageTemplateFile('reloadTransform', _www)
tuple security = ClassSecurityInfo()

Private Member Functions

def _chain_init

Private Attributes

 _object_ids
 _chain

Detailed Description

a transforms chain is suite of transforms to apply in order.
It follows the transform API so that a chain is itself a transform.

Definition at line 85 of file chain.py.


Constructor & Destructor Documentation

def PortalTransforms.chain.TransformsChain.__init__ (   self,
  id,
  description,
  ids = () 
)

Definition at line 108 of file chain.py.

00108 
00109     def __init__(self, id, description, ids=()):
00110         self.id = id
00111         self.description = description
00112         self._object_ids = list(ids)
00113         self.inputs = ('application/octet-stream',)
00114         self.output = 'application/octet-stream'
00115         self._chain = None


Member Function Documentation

build the transforms chain 

Definition at line 116 of file chain.py.

00116 
00117     def _chain_init(self):
00118         """ build the transforms chain """
00119         tr_tool = getToolByName(self, 'portal_transforms')
00120         self._chain = c = chain()
00121         for id in self._object_ids:
00122             object = getattr(tr_tool, id)
00123             c.registerTransform(object)
00124         self.inputs = c.inputs or ('application/octet-stream',)
00125         self.output = c.output or 'application/octet-stream'

Here is the call graph for this function:

Here is the caller graph for this function:

def PortalTransforms.chain.TransformsChain.convert (   self,
  args,
  kwargs 
)
return apply the transform and return the result 

Definition at line 127 of file chain.py.

00127 
00128     def convert(self, *args, **kwargs):
00129         """ return apply the transform and return the result """
00130         if self._chain is None:
00131             self._chain_init()
00132         return self._chain.convert(*args, **kwargs)

Here is the call graph for this function:

Here is the caller graph for this function:

return a list of addable transform 

Definition at line 208 of file chain.py.

00208 
00209     def listAddableObjectIds(self):
00210         """ return a list of addable transform """
00211         tr_tool = getToolByName(self, 'portal_transforms')
00212         return [id for id in tr_tool.objectIds() if not (id == self.id or id in self._object_ids)]

Here is the call graph for this function:

def PortalTransforms.chain.TransformsChain.manage_addObject (   self,
  id,
  REQUEST = None 
)
add a new transform or chain to the chain 

Definition at line 147 of file chain.py.

00147 
00148     def manage_addObject(self, id, REQUEST=None):
00149         """ add a new transform or chain to the chain """
00150         assert id not in self._object_ids
00151         self._object_ids.append(id)
00152         self._chain_init()
00153         if REQUEST is not None:
00154             REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')

Here is the call graph for this function:

def PortalTransforms.chain.TransformsChain.manage_beforeDelete (   self,
  item,
  container 
)

Definition at line 139 of file chain.py.

00139 
00140     def manage_beforeDelete(self, item, container):
00141         Item.manage_beforeDelete(self, item, container)
00142         if self is item:
00143             # unregister self from catalog on deletion
00144             tr_tool = getToolByName(self, 'portal_transforms')
00145             tr_tool.unregisterTransform(self.id)

Here is the call graph for this function:

def PortalTransforms.chain.TransformsChain.manage_delObjects (   self,
  ids,
  REQUEST = None 
)
delete the selected mime types 

Definition at line 156 of file chain.py.

00156 
00157     def manage_delObjects(self, ids, REQUEST=None):
00158         """ delete the selected mime types """
00159         for id in ids:
00160             self._object_ids.remove(id)
00161         self._chain_init()
00162         if REQUEST is not None:
00163             REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
00164 

Here is the call graph for this function:

Here is the caller graph for this function:

def PortalTransforms.chain.TransformsChain.move_object_down (   self,
  id,
  REQUEST = None 
)
move object with the given id down in the list 

Definition at line 188 of file chain.py.

00188 
00189     def move_object_down(self, id, REQUEST=None):
00190         """  move object with the given id down in the list """
00191         newpos = self._object_ids.index(id) + 1
00192         self.move_object_to_position(id, newpos)
00193         if REQUEST is not None:
00194             REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
00195 

Here is the call graph for this function:

overriden from OrderedFolder to store id instead of objects

Definition at line 168 of file chain.py.

00168 
00169     def move_object_to_position(self, id, newpos):
00170         """ overriden from OrderedFolder to store id instead of objects
00171         """
00172         oldpos = self._object_ids.index(id)
00173         if (newpos < 0 or newpos == oldpos or newpos >= len(self._object_ids)):
00174             return 0
00175         self._object_ids.pop(oldpos)
00176         self._object_ids.insert(newpos, id)
00177         self._chain_init()
00178         return 1

Here is the call graph for this function:

Here is the caller graph for this function:

def PortalTransforms.chain.TransformsChain.move_object_up (   self,
  id,
  REQUEST = None 
)
move object with the given id up in the list 

Definition at line 180 of file chain.py.

00180 
00181     def move_object_up(self, id, REQUEST=None):
00182         """  move object with the given id up in the list """
00183         newpos = self._object_ids.index(id) - 1
00184         self.move_object_to_position(id, newpos)
00185         if REQUEST is not None:
00186             REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')

Here is the call graph for this function:

return the name of the transform instance

Definition at line 134 of file chain.py.

00134 
00135     def name(self):
00136         """return the name of the transform instance"""
00137         return self.id

Here is the caller graph for this function:

return a list of addable transform 

Definition at line 214 of file chain.py.

00214 
00215     def objectIds(self):
00216         """ return a list of addable transform """
00217         return tuple(self._object_ids)

Here is the caller graph for this function:

return a list of addable transform 

Definition at line 219 of file chain.py.

00219 
00220     def objectValues(self):
00221         """ return a list of addable transform """
00222         tr_tool = getToolByName(self, 'portal_transforms')
00223         return [getattr(tr_tool, id) for id in self.objectIds()]
00224 
00225 InitializeClass(TransformsChain)

Here is the call graph for this function:

Here is the caller graph for this function:

reload the module where the transformation class is defined 

Definition at line 199 of file chain.py.

00199 
00200     def reload(self):
00201         """ reload the module where the transformation class is defined """
00202         for tr in self.objectValues():
00203             tr.reload()
00204         self._chain_init()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 114 of file chain.py.

Definition at line 111 of file chain.py.

Definition at line 110 of file chain.py.

Definition at line 109 of file chain.py.

Definition at line 112 of file chain.py.

tuple PortalTransforms.chain.TransformsChain.manage_main = PageTemplateFile('editTransformsChain', _www) [static]

Definition at line 103 of file chain.py.

Initial value:
(
                      ({'label':'Configure',
                       'action':'manage_main'},
                       {'label':'Reload',
                       'action':'manage_reloadTransform'},) +
                      Item.manage_options
                      )

Definition at line 95 of file chain.py.

tuple PortalTransforms.chain.TransformsChain.manage_reloadTransform = PageTemplateFile('reloadTransform', _www) [static]

Definition at line 104 of file chain.py.

Definition at line 91 of file chain.py.

tuple PortalTransforms.chain.TransformsChain.meta_types = all_meta_types() [static]

Definition at line 93 of file chain.py.

Definition at line 90 of file chain.py.

Definition at line 113 of file chain.py.

tuple PortalTransforms.chain.TransformsChain.security = ClassSecurityInfo() [static]

Definition at line 106 of file chain.py.


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