예제 #1
0
파일: async.py 프로젝트: gcandal/appier
 def async_file(self):
     file_path = self.field("path", None)
     thread = self.field("thread", False, cast=bool)
     type, _encoding = mimetypes.guess_type(file_path, strict=True)
     type = type or "application/octet-stream"
     self.request.content_type = type
     yield -1
     yield appier.ensure_async(self.read_file,
                               args=[file_path],
                               thread=thread)
예제 #2
0
 def callable(self):
     yield -1
     yield "before\n"
     yield appier.ensure_async(lambda: time.sleep(30.0))
     yield "after\n"
예제 #3
0
 def hello(self):
     yield -1
     yield "before\n"
     yield appier.ensure_async(self.handler)
     yield "after\n"