web2py.gluon.globals.Response

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
include_meta(self) | source code
include_files(self) Caching method for writing out files. | source code
stream(self, stream, chunk_size=65536, request=global_settings.applications_parent) 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=global_settings.applications_parent) | source code
xmlrpc(self, request, methods) assuming: | source code
toolbar(self) | source code
Inherited from `storage.Storage`: `__delattr__`, `__getattr__`, `__getitem__`, `__getstate__`, `__repr__`, `__setattr__`, `__setstate__`, `getfirst`, `getlast`, `getlist` Inherited from `dict`: `__cmp__`, `__contains__`, `__delitem__`, `__eq__`, `__ge__`, `__getattribute__`, `__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)

### include_files(self) | source code
Caching method for writing out files. By default, caches in ram for 5 minutes. To change, response.cache_includes = (cache_method, time_expire). Example: (cache.disk, 60) # caches to disk for 1 minute.

### stream(self, stream, chunk_size=65536, request=global_settings.applications_parent) | 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)