# Path: seth/helpers/unicodecsv.py
# class UnicodeWriter(object):
#     def __init__(self, f, dialect=csv.excel, encoding='utf-8', errors='strict',
#                  *args, **kwds):
#         self.encoding = encoding
#         self.writer = csv.writer(f, dialect, *args, **kwds)
#         self.encoding_errors = errors
# 
#     def writerow(self, row):
#         self.writer.writerow(_stringify_list(row, self.encoding, self.encoding_errors))
# 
#     def writerows(self, rows):
#         for row in rows:
#             self.writerow(row)
# 
#     @property
#     def dialect(self):
#         return self.writer.dialect


import logging
from time import time
from cStringIO import StringIO
from pyramid.renderers import render
from seth.helpers.unicodecsv import UnicodeWriter
        from xhtml2pdf import pisa
            html = value['html']

        try:
            pdf = pisa.CreatePDF(
                StringIO(html.encode('utf-8')), buff, encoding='utf-8'
            )
        except AttributeError:
            raise SethRendererException(u"Error generating PDF file.")

        if pdf.err:
            raise SethRendererException(u"Error generating PDF file.")

        file_name = value.pop('file_name', self.get_filename(value))
        self.prepare_response(request, 'application/pdf', file_name, value)
        result = buff.getvalue()
        buff.close()
        return result


class CsvRenderer(BaseSethRenderer):

    def __init__(self, info):
        self.info = info

    def __call__(self, value, system):
        request = system['request']
        if not 'rows' in value:
            raise SethRendererException(u"No rows provided")

        buff = StringIO()

# Path: seth/helpers/unicodecsv.py
# class UnicodeWriter(object):
#     def __init__(self, f, dialect=csv.excel, encoding='utf-8', errors='strict',
#                  *args, **kwds):
#         self.encoding = encoding
#         self.writer = csv.writer(f, dialect, *args, **kwds)
#         self.encoding_errors = errors
# 
#     def writerow(self, row):
#         self.writer.writerow(_stringify_list(row, self.encoding, self.encoding_errors))
# 
#     def writerows(self, rows):
#         for row in rows:
#             self.writerow(row)
# 
#     @property
#     def dialect(self):
#         return self.writer.dialect


# Path: seth/renderers.py
import logging
from time import time
from cStringIO import StringIO
from pyramid.renderers import render
from seth.helpers.unicodecsv import UnicodeWriter
        from xhtml2pdf import pisa

            html = value['html']

        try:
            pdf = pisa.CreatePDF(
                StringIO(html.encode('utf-8')), buff, encoding='utf-8'
            )
        except AttributeError:
            raise SethRendererException(u"Error generating PDF file.")

        if pdf.err:
            raise SethRendererException(u"Error generating PDF file.")

        file_name = value.pop('file_name', self.get_filename(value))
        self.prepare_response(request, 'application/pdf', file_name, value)
        result = buff.getvalue()
        buff.close()
        return result


class CsvRenderer(BaseSethRenderer):

    def __init__(self, info):
        self.info = info

    def __call__(self, value, system):
        request = system['request']
        if not 'rows' in value:
            raise SethRendererException(u"No rows provided")

        buff = StringIO()

        writer = UnicodeWriter(buff, encoding='utf-8')