hserver-fahrradboerse/hServer/hserver/api/simpleobject.py

17 lines
480 B
Python

from hserver.api.webobject import WebObject,Persistence
import hserver
class SimpleObject(WebObject,Persistence):
def __init__(self,accepts=["*/*"],contenttype="application/octetstream",content=b""):
self.setDefault("update")
self.accepts = accepts
self.contenttype = contenttype
self.content = content
def __call__(self,request,o=None):
request.setResponseHeader("Content-Type",self.contenttype)
request.getBinaryContentFile().write( bytes(self.content) )