OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, gen) |
def | dump (self, fp, encoding=None, errors="strict") |
def | disable_buffering (self) |
def | enable_buffering (self, size=5) |
def | __iter__ (self) |
def | __next__ (self) |
Data Fields | |
buffered | |
A template stream works pretty much like an ordinary python generator but it can buffer multiple items to reduce the number of total iterations. Per default the output is unbuffered which means that for every unbuffered instruction in the template one unicode string is yielded. If buffering is enabled with a buffer size of 5, five items are combined into a new unicode string. This is mainly useful if you are streaming big templates to a client via WSGI which flushes after each iteration.
def __init__ | ( | self, | |
gen | |||
) |
def __iter__ | ( | self | ) |
def __next__ | ( | self | ) |
def disable_buffering | ( | self | ) |
Disable the output buffering.
def dump | ( | self, | |
fp, | |||
encoding = None , |
|||
errors = "strict" |
|||
) |
Dump the complete stream into a file or file-like object. Per default unicode strings are written, if you want to encode before writing specify an `encoding`. Example usage:: Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')
def enable_buffering | ( | self, | |
size = 5 |
|||
) |
Enable buffering. Buffer `size` items before yielding them.
buffered |