Package twisted :: Package web :: Package woven :: Module input :: Class InputHandler
[frames | no frames]

Class InputHandler

Resource --+    
           |    
  Controller --+
               |
              InputHandler

Known Subclasses:
DefaultHandler, List, SingleValue

An InputHandler is like a controller, but it operates on something contained inside of self.model instead of directly on self.model. For example, a Handler whose model has been set to "foo" will handle self.model.foo.

The handler's job is to interpret the request and:
  1. Check for valid input
  2. If the input is valid, update the model
  3. Use any special API of the view widget to change the view (other than what the view updates automatically from the model) e.g. in the case of an error, tell the view to report an error to the user
  4. Return a success value; by default these values are simply recorded and the page is rendered, but these values could be used to determine what page to display next, etc.

Method Summary
  __init__(self, model, parent, name, check, commit, invalidErrorText, submodel, controllerStack)
  aggregateInvalid(self, request, inputhandler, data)
By default we just pass this method call all the way up to the root Controller.
  aggregateValid(self, request, inputhandler, data)
By default we just pass the method calls all the way up to the root Controller.
  check(self, request, data)
Check whether the input in the request is valid for this handler and return a boolean indicating validity.
  commit(self, request, node, data)
It has been determined that the input for the entire form is completely valid; it is now safe for all handlers to commit changes to the model.
  dispatchCheckResult(self, success, request, data)
  getInput(self, request)
Return the data associated with this handler from the request, if any.
  handle(self, request)
By default, we don't do anything
  handleInvalid(self, request, data)
Once it has been determined that the input is invalid, we should tell our view to report this fact to the user.
  handleValid(self, request, data)
It has been determined that the input for this handler is valid; however, that does not mean the entire form is valid.
  initialize(self)
  setNode(self, node)
    Inherited from Controller
  domChanged(self, request, widget, node)
  exit(self, request)
We are done handling the node to which this controller was attached.
  gatheredControllers(self, v, d, request)
  getChild(self, name, request)
Look for a factory method to create the object to handle the next segment of the URL.
  getDynamicChild(self, name, request)
This method is called when getChild cannot find a matching wchild_* method in the Controller.
  getSubcontroller(self, request, node, model, controllerName)
  importControllerLibrary(self, namespace)
  makeView(self, model, templateFile, parentCount)
  pageRenderComplete(self, request)
Override this to recieve notification when the view rendering process is complete.
  process(self, request, **kwargs)
  render(self, request)
Trigger any inputhandlers that were passed in to this Page, then delegate to the View for traversing the DOM.
  renderView(self, request)
  setSubcontrollerFactory(self, name, factory, setup)
  setSubmodel(self, submodel)
  setUp(self, request, *args)
  setupControllerStack(self)
  setView(self, view)
  wchild_index(self, request)
By default, we return ourself as the index.
    Inherited from Resource
  delEntity(self, name)
  getChildForRequest(self, request)
  getChildWithDefault(self, path, request)
Retrieve a static or dynamically generated child resource from me.
  getDynamicEntity(self, name, request)
  getStaticEntity(self, name)
  listDynamicEntities(self, request)
  listDynamicNames(self)
  listEntities(self)
  listNames(self)
  listStaticEntities(self)
  listStaticNames(self)
  putChild(self, path, child)
Register a static child.
  reallyPutEntity(self, name, entity)
  render_HEAD(self, request)
Default handling of HEAD method.

Class Variable Summary
str invalidErrorText = 'Error!'
int setupStacks = 0                                                                     
    Inherited from Controller
tuple __implements__ = (<class twisted.web.woven.interfaces.IC...
int addSlash = 1                                                                     
list controllerLibraries = []
str templateDirectory = ''
NoneType viewFactory = None                                                                  
    Inherited from Resource
int isLeaf = 0                                                                     
NoneType server = None                                                                  

Method Details

aggregateInvalid(self, request, inputhandler, data)

By default we just pass this method call all the way up to the root Controller.
Overrides:
twisted.web.woven.controller.Controller.aggregateInvalid

aggregateValid(self, request, inputhandler, data)

By default we just pass the method calls all the way up to the root Controller. However, an intelligent InputHandler could override this and implement a state machine that waits for all data to be collected and then fires.
Overrides:
twisted.web.woven.controller.Controller.aggregateValid

check(self, request, data)

Check whether the input in the request is valid for this handler and return a boolean indicating validity.

commit(self, request, node, data)

It has been determined that the input for the entire form is completely valid; it is now safe for all handlers to commit changes to the model.

getInput(self, request)

Return the data associated with this handler from the request, if any.

handle(self, request)

By default, we don't do anything
Overrides:
twisted.web.woven.controller.Controller.handle (inherited documentation)

handleInvalid(self, request, data)

Once it has been determined that the input is invalid, we should tell our view to report this fact to the user.

handleValid(self, request, data)

It has been determined that the input for this handler is valid; however, that does not mean the entire form is valid.

Class Variable Details

invalidErrorText

Type:
str
Value:
'Error!'                                                               

setupStacks

Type:
int
Value:
0                                                                     

Generated by Epydoc 2.0 on Sat May 15 20:08:22 2004 http://epydoc.sf.net