Package gavo :: Package web :: Module grend :: Class ServiceBasedPage
[frames] | no frames]

Class ServiceBasedPage

source code

                   object --+                    
                            |                    
       nevow.rend.DataFactory --+                
                                |                
                   object --+   |                
                            |   |                
     nevow.rend.RenderFactory --+                
                                |                
                   object --+   |                
                            |   |                
      nevow.rend.MacroFactory --+                
                                |                
                   object --+   |                
                            |   |                
 nevow.rend.ConfigurableMixin --+                
                                |                
              nevow.rend.Fragment --+            
                                    |            
   nevow.rend.ConfigurableFactory --+            
                                    |            
nevow.rend.FreeformChildMixin --+   |            
                                |   |            
      nevow.rend.ChildLookupMixin --+            
                                    |            
                      nevow.rend.Page --+        
                                        |        
                       object --+       |        
                                |       |        
           common.CommonRenderers --+   |        
                                    |   |        
                      GavoRenderMixin --+        
                                        |        
                                 GavoPage --+    
                                            |    
                            ResourceBasedPage --+
                                                |
                                               ServiceBasedPage
Known Subclasses:

the base class for renderers turning service-based info into character streams.

You will need to provide some way to give rend.Page nevow templates, either by supplying a docFactory or (usually preferably) mixing in CustomTemplateMixin -- or just override renderHTTP to make do without templates.

The class overrides nevow's child and render methods to allow the service to define render_X and data_X methods, too.

You can set an attribute checkedRenderer=False for renderers that are "generic" and do not need to be enumerated in the allowed attribute of the underlying service ("meta renderers").

You can set a class attribute openRenderer=True to make a renderer work even on restricted services (which may make sense for stuff like logout and maybe for metadata inspection).

Instance Methods
 
__init__(self, ctx, service)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
processData(self, rawData, queryMeta=None)
calls the actual service.
source code
 
runService(self, rawData, queryMeta=None)
takes raw data and returns a deferred firing the service result.
source code
 
runServiceWithFormalData(self, rawData, context, queryMeta=None)
runs the service, taking arguments from material preparsed by nevow formal.
source code
 
data_serviceURL(self, renderer)
returns a relative URL for this service using the renderer.
source code
 
renderer(self, ctx, name)
returns a nevow render function named name.
source code
 
child(self, ctx, name)
returns a nevow data function named name.
source code
 
renderHTTP(self, ctx) source code
 
locateChild(self, ctx, segments)
Locate a child page of this one.
source code
 
__provides__(...)
Special descriptor for class __provides__

Inherited from ResourceBasedPage: data_rdId

Inherited from nevow.rend.Page: child_, flattenFactory, onPostFailure, onPostSuccess, rememberStuff, renderString, renderSynchronously, webFormPost

Inherited from nevow.rend.Fragment: get, remember, rend

Inherited from nevow.rend.DataFactory: __providedBy__

Inherited from nevow.rend.RenderFactory: render_data, render_mapping, render_sequence, render_string, render_xml

Inherited from nevow.rend.MacroFactory: macro

Inherited from nevow.rend.ConfigurableMixin: getBinding, getBindingNames, getDefault, postForm

Inherited from GavoRenderMixin: data_meta, data_rd, render_authinfo, render_datameta, render_explodableMeta, render_ifadmin, render_ifdata, render_ifmeta, render_ifnodata, render_ifnoslot, render_ifownmeta, render_ifslot, render_intro, render_meta, render_metahtml, render_prependsite, render_withsidebar

Inherited from common.CommonRenderers: render_commonhead, render_getconfig, render_rootlink, render_unicode, render_urlescape

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

Inherited from nevow.rend.ConfigurableFactory: configurable_, configurable_original, locateConfigurable

Inherited from nevow.rend.ChildLookupMixin: childFactory, putChild

Inherited from nevow.rend.FreeformChildMixin: child_freeform_hand

Class Methods

Inherited from ResourceBasedPage: isBrowseable, isCacheable, makeAccessURL

Class Variables
  checkedRenderer = True
  openRenderer = False
  __implemented__ = <implementedBy gavo.web.grend.ServiceBasedPage>

Inherited from ResourceBasedPage: name, parameterStyle, preferredMethod, resultType, urlUse

Inherited from nevow.rend.Page: addSlash, afterRender, beforeRender, buffered

Inherited from nevow.rend.Fragment: docFactory, original

Inherited from GavoRenderMixin: macroPackage

Inherited from nevow.rend.ChildLookupMixin: children

Properties

Inherited from object: __class__

Method Details

__init__(self, ctx, service)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

processData(self, rawData, queryMeta=None)

source code 

calls the actual service.

This will run in the current thread; you will ususally want to use runService from the main nevow event loop unless you know the service is quick or actually works asynchronously.

runService(self, rawData, queryMeta=None)

source code 

takes raw data and returns a deferred firing the service result.

This will process everything in a thread.

runServiceWithFormalData(self, rawData, context, queryMeta=None)

source code 

runs the service, taking arguments from material preparsed by nevow formal.

This is the entry point for the form renderer and its friends.

data_serviceURL(self, renderer)

source code 

returns a relative URL for this service using the renderer.

This is ususally used like this:

<a><n:attr name="href" n:data="serviceURL info" n:render="data">x</a>

Overrides: ResourceBasedPage.data_serviceURL

renderer(self, ctx, name)

source code 

returns a nevow render function named name.

This overrides the method inherited from nevow's RenderFactory to add a lookup in the page's service service.

Overrides: nevow.rend.RenderFactory.renderer

child(self, ctx, name)

source code 

returns a nevow data function named name.

In addition to nevow's action, this also looks methods up in the service.

Overrides: nevow.rend.DataFactory.child

renderHTTP(self, ctx)

source code 
Overrides: nevow.rend.Page.renderHTTP

locateChild(self, ctx, segments)

source code 

Locate a child page of this one. ctx is a nevow.context.PageContext representing the parent Page, and segments is a tuple of each element in the URI. An tuple (page, segments) should be returned, where page is an instance of nevow.rend.Page and segments a tuple representing the remaining segments of the URI. If the child is not found, return NotFound instead.

locateChild is designed to be easily overridden to perform fancy lookup tricks. However, the default locateChild is useful, and looks for children in three places, in this order:

  • in a dictionary, self.children
  • a member of self named child_<childname>. This can be either an attribute or a method. If an attribute, it should be an object which can be adapted to IResource. If a method, it should take the context and return an object which can be adapted to IResource.
  • by calling self.childFactory(ctx, name). Name is a single string instead of a tuple of strings. This should return an object that can be adapted to IResource.
Overrides: nevow.rend.FreeformChildMixin.locateChild

__provides__(...)

 

Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.

Overrides: nevow.rend.FreeformChildMixin.__provides__