예제 #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())
예제 #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())
예제 #3
0
def load_asset_content(fullpath):
    asset = Asset.query(Asset.fullpath == fullpath).fetch(1)
    if asset: return asset[0].content
예제 #4
0
def load_asset_content(fullpath):
    asset = Asset.query(Asset.fullpath == fullpath).fetch(1)
    if asset: return asset[0].content