Package web2py :: Package gluon :: Module globals :: Class Response |
[hide private]
[frames] | no frames]

# Class Response

source code

     object --+
              |
           dict --+
                  |
    storage.Storage --+
                      |
                     Response

defines the response object and the default values of its members response.write( ) can be used to write in the output html

Instance Methods | [hide private]
__init__(self) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
write(self, data, escape=True) | source code
render(self, *a, **b) | source code
stream(self, stream, chunk_size=65536, request=1) if a controller function: | source code
download(self, request, db, chunk_size=65536, attachment=True) example of usage in controller: | source code
json(self, data, default=1) | source code
xmlrpc(self, request, methods) assuming: | source code
toolbar(self) | source code
Inherited from `storage.Storage`: `__delattr__`, `__getattr__`, `__getstate__`, `__repr__`, `__setattr__`, `__setstate__`, `getfirst`, `getlast`, `getlist` Inherited from `dict`: `__cmp__`, `__contains__`, `__delitem__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__gt__`, `__hash__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__ne__`, `__new__`, `__setitem__`, `clear`, `copy`, `fromkeys`, `get`, `has_key`, `items`, `iteritems`, `iterkeys`, `itervalues`, `keys`, `pop`, `popitem`, `setdefault`, `update`, `values` Inherited from `object`: `__reduce__`, `__reduce_ex__`, `__str__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (Constructor) | source code
  x.__init__(...) initializes x; see x.__class__.__doc__ for signature Returns:
      new empty dictionary
Overrides: dict.__init__ (inherited documentation)

### stream(self, stream, chunk_size=65536, request=1) | source code
if a controller function:
       return response.stream(file, 100)
the file content will be streamed at 100 bytes at the time

### download(self, request, db, chunk_size=65536, attachment=True) | source code
example of usage in controller:
       def download():
           return response.download(request, db)
downloads from http://..../download/filename

### xmlrpc(self, request, methods) | source code
assuming:
       def add(a, b):
           return a+b
if a controller function "func":
       return response.xmlrpc(request, [add])
the controller will be able to handle xmlrpc requests for the add function. Example:
       import xmlrpclib
       connection = xmlrpclib.ServerProxy('http://hostname/app/contr/func')
       print connection.add(3, 4)