PPaste!

Open correction

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Source 

    def render_file(self, request, template,
                    object_list, output_path):
        template = loader.get_template(template)

        context = self.get_config_dict()
        context['object_list'] = object_list

        try:
            with open(output_path, "w") as o:
                o.write(template.render(context, request))
        except OSError as e:
            # Do something