@task()
@timeit
def render_document_cascade(base):
 try:
  pin_this_thread()
  todo = set([base])
  done = set()
  while todo:
   d = todo.pop()
   if (d in done):
    continue
   d.html = d.parse_and_calculate_links()
   d.save()
   done.add(d)
   todo.update((l.linked_from for l in d.links_to().filter(kind__in=['template', 'include'])))
 finally:
  unpin_this_thread()

@ task ( ) @ timeit def render_document_cascade ( base ) : try : pin_this_thread ( ) todo = set ( [ base ] ) done = set ( ) while todo : d = todo . pop ( ) if ( d in done ) : continue d . html = d . parse_and_calculate_links ( ) d . save ( ) done . add ( d ) todo . update ( ( l . linked_from for l in d . links_to ( ) . filter ( kind__in = [ 'template' , 'include' ] ) ) ) finally : unpin_this_thread ( )
given a document .