Package gavo :: Package protocols :: Module datalink :: Class DataFormatter
[frames] | no frames]

Class DataFormatter

source code

                   object --+                    
                            |                    
 base.structure.StructureBase --+                
                                |                
                   object --+   |                
                            |   |                
           base.common.Parser --+                
                                |                
base.structure.ParseableStructure --+            
                                    |            
             base.structure.Structure --+        
                                        |        
                           object --+   |        
                                    |   |        
      base.structure.RestrictionMixin --+        
                                        |        
                   rscdef.procdef.ProcDef --+    
                                            |    
                       rscdef.procdef.ProcApp --+
                                                |
                                               DataFormatter

A procedure application that renders data in a processed service.

These play the role of the renderer, which for datalink is ususally trivial. They are supposed to take descriptor.data and return a pair of (mime-type, bytes), which is understood by most renderers.

When no dataFormatter is given for a core, it will return descriptor.data directly. This can work with the datalink renderer itself if descriptor.data will work as a nevow resource (i.e., has a renderHTTP method, as our usual products do). Consider, though, that renderHTTP runs in the main event loop and thus most not block for extended periods of time.

The following names are available to the code:

In addition to the usual names available to ProcApps, data formatters have:

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods

Inherited from rscdef.procdef.ProcApp: breakCircles, compile, completeElement, getBodySetupCode, getFuncCode, getLateSetupCode, getParSetupCode, getSetupCode, getSetupPars, onElementComplete, validate

Inherited from rscdef.procdef.ProcDef: getCode

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'dataFormatter'
hash(x)
  requiredType = 'dataFormatter'
hash(x)
  formalArgs = 'descriptor, args'
  additionalNamesForProcs = {"Page": rend.Page, "IRequest": inev...

Inherited from rscdef.procdef.ProcApp: attrSeq, managedAttrs

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__

Class Variable Details

additionalNamesForProcs

Value:
{"Page": rend.Page, "IRequest": inevow.IRequest, "File": _File, "Tempo\
raryFile": _TemporaryFile, "soda": soda,}