Ejemplo n.º 1
0
    def download(self):
        q = Asset.query()
        assets = q.fetch(100)
        output = StringIO.StringIO()

        with zipfile.ZipFile(output, 'w') as zf:
            for a in assets:
                zf.writestr(a.fullpath.lstrip('/'), a.content)

        self.response.headers['Content-Type'] = 'application/zip'
        self.response.headers['Content-Disposition'] = 'attachment; filename="%s"' % 'site.zip'
        self.response.write(output.getvalue())
Ejemplo n.º 2
0
    def download(self):
        q = Asset.query()
        assets = q.fetch(100)
        output = StringIO.StringIO()

        with zipfile.ZipFile(output, 'w') as zf:
            for a in assets:
                zf.writestr(a.fullpath.lstrip('/'), a.content)

        self.response.headers['Content-Type'] = 'application/zip'
        self.response.headers[
            'Content-Disposition'] = 'attachment; filename="%s"' % 'site.zip'
        self.response.write(output.getvalue())
Ejemplo n.º 3
0
def load_asset_content(fullpath):
    asset = Asset.query(Asset.fullpath == fullpath).fetch(1)
    if asset: return asset[0].content
Ejemplo n.º 4
0
def load_asset_content(fullpath):
    asset = Asset.query(Asset.fullpath == fullpath).fetch(1)
    if asset: return asset[0].content