예제 #1
0
 def hello(self):
     partial = self.field("partial", True, cast = bool)
     handler = self.handler_partial if partial else self.handler
     yield from appier.header_a()
     yield "before\n"
     yield from appier.ensure_a(handler)
     yield "after\n"
예제 #2
0
 def hello(self):
     partial = self.field("partial", True, cast = bool)
     handler = self.handler_partial if partial else self.handler
     for value in appier.header_a(): yield value
     yield "before\n"
     for value in appier.ensure_a(handler): yield value
     yield "after\n"
예제 #3
0
파일: async_old.py 프로젝트: acaldas/appier
 def callable(self):
     sleep = self.field("sleep", 3.0, cast=float)
     for value in appier.header_a():
         yield value
     yield "before\n"
     for value in appier.ensure_a(lambda: time.sleep(sleep)):
         yield value
     yield "after\n"
예제 #4
0
 def file(self):
     file_path = self.field("path", None, mandatory=True)
     delay = self.field("delay", 0.0, cast=float)
     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 from appier.header_a()
     yield from appier.ensure_a(self.read_file,
                                args=[file_path],
                                kwargs=dict(delay=delay),
                                thread=thread)
예제 #5
0
 def file(self):
     file_path = self.field("path", None)
     delay = self.field("delay", 0.0, cast = float)
     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
     for value in appier.header_a(): yield value
     for value in appier.ensure_a(
         self.read_file,
         args = [file_path],
         kwargs = dict(delay = delay),
         thread = thread
     ): yield value
예제 #6
0
 def callable(self):
     for value in appier.header_a(): yield value
     yield "before\n"
     for value in appier.ensure_a(lambda: time.sleep(30.0)): yield value
     yield "after\n"
예제 #7
0
 def callable(self):
     sleep = self.field("sleep", 3.0, cast=float)
     yield from appier.header_a()
     yield "before\n"
     yield from appier.ensure_a(lambda: time.sleep(sleep))
     yield "after\n"
예제 #8
0
 def callable(self):
     sleep = self.field("sleep", 3.0, cast = float)
     for value in appier.header_a(): yield value
     yield "before\n"
     for value in appier.ensure_a(lambda: time.sleep(sleep)): yield value
     yield "after\n"
예제 #9
0
 def jobs(self, id):
     self.request.set_content_type("application/json")
     for value in appier.header_a(): yield value
     for value in appier.ensure_a(self.gen_wait_jobs(id)): yield value
예제 #10
0
 def callable(self):
     yield from appier.header_a()
     yield "before\n"
     yield from appier.ensure_a(lambda: time.sleep(30.0))
     yield "after\n"
예제 #11
0
 def callable(self):
     sleep = self.field("sleep", 3.0, cast = float)
     yield from appier.header_a()
     yield "before\n"
     yield from appier.ensure_a(lambda: time.sleep(sleep))
     yield "after\n"