Package gavo :: Package svcs :: Module service :: Class CustomDF
[frames] | no frames]

Class CustomDF

source code

                   object --+                
                            |                
 base.structure.StructureBase --+            
                                |            
                   object --+   |            
                            |   |            
           base.common.Parser --+            
                                |            
base.structure.ParseableStructure --+        
                                    |        
             base.structure.Structure --+    
                                        |    
                           object --+   |    
                                    |   |    
      base.structure.RestrictionMixin --+    
                                        |    
                       CustomPageFunction --+
                                            |
                                           CustomDF

A custom data function for a service.

Custom data functions can be used to expose certain aspects of a service to Nevow templates. Thus, their definition usually only makes sense with custom templates, though you could, in principle, override built-in render functions.

In the data functions, you have the names ctx for nevow's context and data for whatever data the template passes to the renderer.

You can access the embedding service as service, the embedding RD as service.rd.

You can return arbitrary python objects -- whatever the render functions can deal with. You could, e.g., write:

       <customDF name="now">
               return datetime.datetime.utcnow()
       </customDF>

You also see a nevow context within the function. You can use that to access a query paramter ``order`` like this:

 args = inevow.IRequest(ctx).args
       sortOrder = args.get("order", ["authors"])
Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods

Inherited from CustomPageFunction: onElementComplete

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

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

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, 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_ = 'customDF'
a sentinel for all kinds of undefined values.

Inherited from CustomPageFunction: attrSeq, managedAttrs

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__