Back to index

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

List of all members.

Public Member Functions

def __init__
def __call__
def manage_afterAdd
def writableDefaults

Public Attributes

 filepath

Static Public Attributes

string meta_type = 'Filesystem Controller Python Script'
tuple manage_options
int is_validator = 0
tuple security = ClassSecurityInfo()

Private Member Functions

def _updateFromFS
def _readMetadata
def _readFile
def _createZODBClone
def _getState

Private Attributes

 _filepath

Detailed Description

FSControllerPythonScripts act like Controller Python Scripts but are not
directly modifiable from the management interface.

Definition at line 35 of file FSControllerPythonScript.py.


Constructor & Destructor Documentation

def CMFFormController.FSControllerPythonScript.FSControllerPythonScript.__init__ (   self,
  id,
  filepath,
  fullname = None,
  properties = None 
)

Definition at line 57 of file FSControllerPythonScript.py.

00057 
00058     def __init__(self, id, filepath, fullname=None, properties=None):
00059         BaseClass.__init__(self, id, filepath, fullname, properties)
00060         self.filepath = self._filepath = filepath  # add _filepath for compatibility with pending CMF patch
00061         try:
00062             self._read_action_metadata(self.getId(), filepath)
00063             self._read_validator_metadata(self.getId(), self.filepath)
00064         except (ValueError, CompilerError), e:
00065             log(summary='metadata error', text='file = %s' % filepath)
00066             raise
00067 


Member Function Documentation

Definition at line 83 of file FSControllerPythonScript.py.

00083 
00084     def __call__(self, *args, **kwargs):
00085         REQUEST = self.REQUEST
00086         controller = getToolByName(self, 'portal_form_controller')
00087         controller_state = controller.getState(self, is_validator=0)
00088         controller_state = self.getButton(controller_state, REQUEST)
00089         validators = self.getValidators(controller_state, REQUEST).getValidators()
00090 
00091         # put all arguments into a dict
00092         c = self.func_code
00093         param_names = c.co_varnames[:c.co_argcount]
00094         argdict = {}
00095         index = 0
00096         # grab the names for positional arguments out of the function code
00097         for a in args:
00098             argdict[param_names[index]] = a
00099             index += 1
00100         argdict.update(kwargs)
00101 
00102         controller_state = controller.validate(controller_state, REQUEST, validators, argdict)
00103 
00104         if controller_state.getStatus() == 'success':
00105             result = FSControllerPythonScript.inheritedAttribute('__call__')(self, *args, **kwargs)
00106             if getattr(result, '__class__', None) == ControllerState and not result._isValidating():
00107                 return self.getNext(result, self.REQUEST)
00108             return result
00109         else:
00110             return self.getNext(controller_state, self.REQUEST)
00111 

Here is the call graph for this function:

Here is the caller graph for this function:

Create a ZODB (editable) equivalent of this object.

Definition at line 126 of file FSControllerPythonScript.py.

00126 
00127     def _createZODBClone(self):
00128         """Create a ZODB (editable) equivalent of this object."""
00129         obj = ControllerPythonScript(self.getId(), filepath=self.filepath)
00130         obj.write(self.read())
00131         obj.validators = copy.copy(Acquisition.aq_base(self.validators))  # XXX - don't forget to enable this
00132         obj.actions = copy.copy(Acquisition.aq_base(self.actions))
00133         return obj
00134 

Definition at line 140 of file FSControllerPythonScript.py.

00140 
00141     def _getState(self):
00142         return getToolByName(self, 'portal_form_controller').getState(self, is_validator=0)
00143 
00144 
00145 Globals.InitializeClass(FSControllerPythonScript)
00146 
00147 
00148 registerFileExtension('cpy', FSControllerPythonScript)
00149 registerMetaType('Controller Python Script', FSControllerPythonScript)

Here is the call graph for this function:

Definition at line 78 of file FSControllerPythonScript.py.

00078 
00079     def _readFile(self, reparse):
00080         BaseClass._readFile(self, reparse)
00081         self._readMetadata()
00082 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 73 of file FSControllerPythonScript.py.

00073 
00074     def _readMetadata(self):
00075         # workaround for Python 2.1 multiple inheritance lameness
00076         return self._baseReadMetadata()
00077 
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 68 of file FSControllerPythonScript.py.

00068 
00069     def _updateFromFS(self):
00070         # workaround for Python 2.1 multiple inheritance lameness
00071         return self._baseUpdateFromFS()
00072 
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 113 of file FSControllerPythonScript.py.

00113 
00114     def manage_afterAdd(self, object, container):
00115         try:
00116             BaseClass.manage_afterAdd(self, object, container)
00117             # Re-read .metadata after adding so that we can do validation checks
00118             # using information in portal_form_controller.  Since manage_afterAdd
00119             # is not guaranteed to run, we also call these in __init__
00120             self._read_action_metadata(self.getId(), self.filepath)
00121             self._read_validator_metadata(self.getId(), self.filepath)
00122         except:
00123             log(summary='metadata error', text='file = %s' % self.filepath)
00124             logException()
00125             raise

Can default actions and validators be modified?

Definition at line 136 of file FSControllerPythonScript.py.

00136 
00137     def writableDefaults(self):
00138         """Can default actions and validators be modified?"""
00139         return 0


Member Data Documentation

Definition at line 59 of file FSControllerPythonScript.py.

Definition at line 59 of file FSControllerPythonScript.py.

Definition at line 51 of file FSControllerPythonScript.py.

Initial value:
(
           (
            {'label':'Customize', 'action':'manage_main'},
            {'label':'Test', 'action':'ZScriptHTML_tryForm'},
            {'label':'Validation','action':'manage_formValidatorsForm'},
            {'label':'Actions','action':'manage_formActionsForm'},
           ) + Cacheable.manage_options)

Definition at line 43 of file FSControllerPythonScript.py.

string CMFFormController.FSControllerPythonScript.FSControllerPythonScript.meta_type = 'Filesystem Controller Python Script' [static]

Definition at line 39 of file FSControllerPythonScript.py.

Definition at line 54 of file FSControllerPythonScript.py.


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