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

Class InputHandler

Collection --+                
             |                
   Constrained --+            
                 |            
  ConfigCollection --+        
                     |        
              Resource --+    
                         |    
                Controller --+
                             |
                            InputHandler

Known Subclasses:
SingleValue, List, DefaultHandler

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.
  delEntity(self, name)
Remove a static reference for 'name'. (inherited from Resource)
  dispatchCheckResult(self, success, request, data)
  domChanged(self, request, widget, node)
(inherited from Controller)
  entityConstraint(self, entity)
A method that determines whether an entity may be added to me. (inherited from ConfigCollection)
  gatheredControllers(self, v, d, request)
(inherited from Controller)
  getChild(self, name, request)
Look for a factory method to create the object to handle the next segment of the URL. (inherited from Controller)
  getChildForRequest(self, request)
(internal) Get a child of mine dependant on a particular request. (inherited from Resource)
  getChildWithDefault(self, path, request)
Retrieve a static or dynamically generated child resource from me. (inherited from Resource)
  getDynamicChild(self, name, request)
This method is called when getChild cannot find a matching wchild_* method in the Controller. (inherited from Controller)
  getDynamicEntity(self, name, request)
Subclass this to generate an entity on demand. (inherited from Resource)
  getEntity(self, name, request)
Retrieve an entity from me. (inherited from Collection)
  getEntityType(self)
(inherited from ConfigCollection)
  getInput(self, request)
Return the data associated with this handler from the request, if any.
  getNameType(self)
(inherited from ConfigCollection)
  getStaticEntity(self, name)
Get an entity that was added to me using putEntity. (inherited from Resource)
  getSubcontroller(self, request, node, model, controllerName)
(inherited from Controller)
  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.
  importControllerLibrary(self, namespace)
(inherited from Controller)
  initialize(self)
  listDynamicEntities(self, request)
A list of all name, entity that I can generate on demand. (inherited from Resource)
  listDynamicNames(self)
Retrieve a list of the names of entities that I store references to. (inherited from Resource)
  listEntities(self)
(inherited from Resource)
  listNames(self)
(inherited from Resource)
  listStaticEntities(self)
Retrieve a list of all name, entity pairs that I store references to. (inherited from Resource)
  listStaticNames(self)
Retrieve a list of the names of entities that I store references to. (inherited from Resource)
  makeView(self, model, templateFile, parentCount)
(inherited from Controller)
  nameConstraint(self, name)
A method that determines whether an entity may be added to me with a given name. (inherited from Constrained)
  pageRenderComplete(self, request)
Override this to recieve notification when the view rendering process is complete. (inherited from Controller)
  process(self, request, **kwargs)
(inherited from Controller)
  putChild(self, path, child)
Register a static child. (inherited from Resource)
  putEntity(self, name, entity)
Store an entity if it meets both constraints. (inherited from Constrained)
  reallyPutEntity(self, name, entity)
(inherited from Resource)
  removeEntity(self, name, request)
Remove an entity for 'name', based on the content of 'request'. (inherited from Collection)
  render(self, request)
Trigger any inputhandlers that were passed in to this Page, then delegate to the View for traversing the DOM. (inherited from Controller)
  renderView(self, request)
(inherited from Controller)
  setNode(self, node)
  setSubcontrollerFactory(self, name, factory, setup)
(inherited from Controller)
  setSubmodel(self, submodel)
(inherited from Controller)
  setUp(self, request, *args)
(inherited from Controller)
  setupControllerStack(self)
(inherited from Controller)
  setView(self, view)
(inherited from Controller)
  storeEntity(self, name, request)
Store an entity for 'name', based on the content of 'request'. (inherited from Collection)
  wchild_index(self, request)
By default, we return ourself as the index. (inherited from Controller)

Class Variable Summary
str invalidErrorText
int setupStacks

Method Details

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. However, an intelligent InputHandler could override this and implement a state machine that waits for all data to be collected and then fires.

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 1.1 on Thu May 8 13:19:13 2003 http://epydoc.sf.net