Package twisted :: Package web :: Package woven :: Module view :: Class View

[show private | hide private]
[frames | no frames]

## Class View

Known Subclasses:
  `ThankYou`, `Widget`, `Page`, `LiveView`, `TapestryView`

Method Summary
| ``__init__`(self, m, templateFile, templateDirectory, controller, doneCallback, modelStack, viewStack, controllerStack)` A view must be told what its model is, and may be told what its controller is, but can also look up its controller if none specified.
| `__setitem__(self, key, value)`
| ``dispatchResult`(self, request, node, result)` Check a given result from handling a node and look up a NodeMutator adapter which will convert the result into a node and insert it into the DOM tree.
| ``dispatchResultCallback`(self, result, request, node)` Deal with a callback from a deferred, dispatching the result and recursing children.
| ``generate`(self, request, node)` Allow a view to be used like a widget.
| `getChild(self, path, request)`
| `getChildWithDefault(self, path, request)`
| ``getNodeController`(self, request, node, submodel, model)` Get a controller object to handle this node.
| ``getNodeModel`(self, request, node, submodel)` Get the model object associated with this node.
| `getNodeView(self, request, node, submodel, model)`
| ``getSubview`(self, request, node, model, viewName)` Get a sub-view from me.
| ``getTemplate`(self, request)` Override this if you want to have your subclass look up its template using a different method.
| `handleControllerResults(self, controllerResult, request, node, controller, view, success)`
| ``handleDocument`(self, request, document)` Handle the root node, and send the page if there are no outstanding callbacks when it returns.
| `handleNewNode(self, request, returnNode)`
| `handleNode(self, request, node)`
| `handleOutstanding(self, request)`
| `importViewLibrary(self, namespace)`
| ``lookupTemplate`(self, request)` Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template.
| ``modelChanged`(self, changed)` Dispatch changed messages to any update_* methods which may have been defined, then pass the update notification on to the controller.
| ``recurseChildren`(self, request, node)` If this node has children, handle them.
| `render(self, request, doneCallback)`
| `renderFailure(self, failure, request)`
| ``sendPage`(self, request)` Check to see if handlers recorded any errors before sending the page
| `setController(self, controller)`
| `setNode(self, node)`
| `setSubmodel(self, name)`
| `setSubviewFactory(self, name, factory, setup, *args, **kwargs)`
| `setUp(self, request, d)`
| `setupAllStacks(self)`
| `setupViewStack(self)`
| `unlinkViews(self)`

Class Variable Summary
`tuple` | `__implements__`
`int` | `isLeaf`
`int` | `setupStacks`
`string` | `template`
`string` | `templateDirectory`
`string` | `templateFile`
`list` | `viewLibraries`
`int` | `wantsAllNotifications`

Method Details

### __init__(self, m, templateFile=None, templateDirectory=None, controller=None, doneCallback=None, modelStack=None, viewStack=None, controllerStack=None)
(Constructor)

A view must be told what its model is, and may be told what its controller is, but can also look up its controller if none specified.

### dispatchResult(self, request, node, result)

Check a given result from handling a node and look up a NodeMutator adapter which will convert the result into a node and insert it into the DOM tree. Return the new node.

### dispatchResultCallback(self, result, request, node)

Deal with a callback from a deferred, dispatching the result and recursing children.

### generate(self, request, node)

Allow a view to be used like a widget. Will look up the template file and return it in place of the incoming node.

### getNodeController(self, request, node, submodel, model)

Get a controller object to handle this node. If the node has no controller= attribute, first check to see if there is an IController adapter for our model.

### getNodeModel(self, request, node, submodel)

Get the model object associated with this node. If this node has a model= attribute, call getSubmodel on the current model object. If not, return the top of the model stack.

### getSubview(self, request, node, model, viewName)

Get a sub-view from me.

  Returns:
    `widgets.Widget`

### getTemplate(self, request)

Override this if you want to have your subclass look up its template using a different method.

### handleDocument(self, request, document)

Handle the root node, and send the page if there are no outstanding callbacks when it returns.

### lookupTemplate(self, request)

Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template. The first time the template is used it is cached for speed.

### modelChanged(self, changed)

Dispatch changed messages to any update_* methods which may have been defined, then pass the update notification on to the controller.

### recurseChildren(self, request, node)

If this node has children, handle them.

### sendPage(self, request)

Check to see if handlers recorded any errors before sending the page

Class Variable Details

### __implements__

  Type:
    `tuple`
  Value:

        (<class twisted.web.resource.IResource at 0x82e7414>,
         <class twisted.web.woven.interfaces.IView at 0x86fe2cc>)

### isLeaf

  Type:
    `int`
  Value:

        1

### setupStacks

  Type:
    `int`
  Value:

        1

### template

  Type:
    `string`
  Value:

        ''

### templateDirectory

  Type:
    `string`
  Value:

        ''

### templateFile

  Type:
    `string`
  Value:

        ''

### viewLibraries

  Type:
    `list`
  Value:

        []

### wantsAllNotifications

  Type:
    `int`
  Value:

        0

Generated by Epydoc 1.1 on Sat Feb 15 21:18:20 2003 | http://epydoc.sf.net