Module AjaxStub :: Class AjaxStubDispatch
[show private | hide private]
[frames | no frames]

Type AjaxStubDispatch

object --+
         |
        AjaxStubDispatch

Known Subclasses:
AjaxStub

Dispatch the JavaScript API to the client.
Method Summary
  __init__(self, cType)
  addContentType(self, typeMap)
Add new content types to the defaults. (Class method)
  dispatchJavascript(self)
Dispatch the JavaScript request code, of your choice, plus the stubs to standard out.
  initRequest(self)
Send the content type to the client.
  processClientRequest(self)
Print to standard out the results of the requested function or method call.
  _encodeHTML(self, data)
Encode HTML for sending to the client.
  _encodeJSON(self, data)
Encode JSON to send to the client.
  _encodeXML(self, data)
Encode XML to send to the client.
  _getContentType(self)
Returns the content type.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
str HTML = 'HTML'
str JSON = 'JSON'
str XML = 'XML'
dict _AjaxStubDispatch__CONTENT_TYPE = {'XML': 'text/xml', 'J...

Instance Method Details

__init__(self, cType='HTML')
(Constructor)

Parameters:
cType - The content type. (ie. HTML, JSON, XML)
Overrides:
__builtin__.object.__init__

dispatchJavascript(self)

Dispatch the JavaScript request code, of your choice, plus the stubs to standard out.

initRequest(self)

Send the content type to the client.

processClientRequest(self)

Print to standard out the results of the requested function or method call.

_encodeHTML(self, data)

Encode HTML for sending to the client. We just send the raw data for HTML.

NOTE: It is recommended that this feature not be used as it has no way to return errors to the client.
Parameters:
data - The results of the function or method call.
Returns:
The raw data.

_encodeJSON(self, data)

Encode JSON to send to the client.
Parameters:
data - The results of the function or method call.
Returns:
The string encoded JSON.

_encodeXML(self, data)

Encode XML to send to the client.
Parameters:
data - The results of the function or method call.
Returns:
The encoded XML.

_getContentType(self)

Returns the content type.
Returns:
The content type.

Class Method Details

addContentType(self, typeMap)

Add new content types to the defaults.
Parameters:
typeMap - A dict of keys and content types.

Class Variable Details

HTML

Type:
str
Value:
'HTML'                                                                 

JSON

Type:
str
Value:
'JSON'                                                                 

XML

Type:
str
Value:
'XML'                                                                  

_AjaxStubDispatch__CONTENT_TYPE

Type:
dict
Value:
{'XML': 'text/xml', 'JSON': 'text/x-json', 'HTML': 'text/html'}        

Generated by Epydoc 2.1 on Fri Aug 3 23:25:20 2007 http://epydoc.sf.net