def unpack(request, key, name): price = memcache.get('price_%s' % key) if not price: try: price = Price.get(key) except BadKeyError: return redirect(url_for('price/index')) if price: memcache.add('price_%s' % key, price, 1200) if price: blob = BlobInfo.get(price.file_key) headers = Headers() headers['Content-Type'] = blob.content_type.encode('utf-8') headers['Last-Modified'] = price.modif_time.strftime(HTTP_DATE_FMT) return Response(blob.open().read(), headers=headers) return Response(status=304)
def price_delete(request, key): price = Price.get(key) if price: price.delete() return redirect('/admin/prices')