Esempio n. 1
0
 def parse_body(self, headers, body):
     ctype = headers.get('content-type')
     if ctype == CT_BINARY_PLIST:
         parsedbody = read_binary_plist(StringIO(body))
     else:
         parsedbody = HTTPMessage(StringIO(body))
     return parsedbody
Esempio n. 2
0
 def render_PUT(self, request):
     ctype = request.getAllHeaders().get('content-type')
     if ctype == CT_BINARY_PLIST:
         prop = request.uri.rsplit("?", 1)[1]
         parsedbody = read_binary_plist(StringIO(request.content.read()))
         value = parsedbody.get("value")
         self.apserver.set_property(prop, value)
     else:
         raise Exception("Unexpected content type for setProperty: %s" % ctype)
     return ""