Ejemplo n.º 1
0
def parse_upload(dataset, id):
    upload = Upload.by_id(id)
    if upload is None:
        return None, None
    fh = open(upload.path, 'rb')
    fn, ext = os.path.splitext(upload.filename)
    ext = ext[1:] if ext else None
    table_set = AnyTableSet.from_fileobj(fh,
            mimetype=upload.mimetype,
            extension=ext[1:])
    return upload, table_set.tables[0]