CheeseAPI 0.4.7__tar.gz → 0.4.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ class Handle:
130
130
  self.worker_start(sock, True)
131
131
 
132
132
  for process in processes:
133
- os.kill(process.pid, signal.SIGKILL)
133
+ process.terminate()
134
134
  process.join()
135
135
 
136
136
  for text in self._app._text.server_stopping():
@@ -142,7 +142,7 @@ class Handle:
142
142
 
143
143
  logger.destroy()
144
144
 
145
- os.kill(os.getpid(), signal.SIGKILL)
145
+ os.killpg(os.getpid(), signal.SIGKILL)
146
146
 
147
147
  def worker_beforeStarting(self):
148
148
  for text in self._app._text.worker_starting():
@@ -275,7 +275,6 @@ class Handle:
275
275
  return
276
276
 
277
277
  if e.args[0] == 1:
278
- await self.http_options(protocol)
279
278
  if isinstance(protocol.response, BaseResponse):
280
279
  if self._app.signal.http_options.receivers:
281
280
  await self._app.signal.http_options.send_async(**{
@@ -350,10 +349,31 @@ class Handle:
350
349
  async def http_404(self, protocol: 'HttpProtocol'):
351
350
  protocol.response = Response(status = http.HTTPStatus.NOT_FOUND)
352
351
 
353
- async def http_options(self, protocol: 'HttpProtocol'):
352
+ async def http_405(self, protocol: 'HttpProtocol'):
353
+ protocol.response = Response(status = http.HTTPStatus.METHOD_NOT_ALLOWED)
354
+
355
+ async def http_500(self, protocol: 'HttpProtocol', e: BaseException, recycled: bool = False):
356
+ protocol.response = Response(status = http.HTTPStatus.INTERNAL_SERVER_ERROR)
357
+
358
+ if not recycled:
359
+ for text in self._app._text.http_500(protocol, e):
360
+ logger.danger(text[0], text[1])
361
+
362
+ async def http_response(self, protocol: 'HttpProtocol', recycled: bool = False):
363
+ if not isinstance(protocol.response, BaseResponse):
364
+ await self.noResponse(protocol)
365
+
366
+ if not recycled:
367
+ await self.http_beforeResponse(protocol)
368
+ if self._app.signal.http_beforeResponse.receivers:
369
+ await self._app.signal.http_beforeResponse.send_async(**{
370
+ 'request': protocol.request,
371
+ 'response': protocol.response,
372
+ **protocol.kwargs
373
+ })
374
+
354
375
  if (
355
- protocol.request.method == http.HTTPMethod.OPTIONS
356
- and (
376
+ (
357
377
  protocol.request.origin not in self._app.cors.exclude_origin
358
378
  and
359
379
  (
@@ -380,29 +400,6 @@ class Handle:
380
400
  elif self._app.cors.headers:
381
401
  protocol.response.headers['Access-Control-Allow-Headers'] = ', '.join(self._app.cors.headers)
382
402
 
383
- async def http_405(self, protocol: 'HttpProtocol'):
384
- protocol.response = Response(status = http.HTTPStatus.METHOD_NOT_ALLOWED)
385
-
386
- async def http_500(self, protocol: 'HttpProtocol', e: BaseException, recycled: bool = False):
387
- protocol.response = Response(status = http.HTTPStatus.INTERNAL_SERVER_ERROR)
388
-
389
- if not recycled:
390
- for text in self._app._text.http_500(protocol, e):
391
- logger.danger(text[0], text[1])
392
-
393
- async def http_response(self, protocol: 'HttpProtocol', recycled: bool = False):
394
- if not isinstance(protocol.response, BaseResponse):
395
- await self.noResponse(protocol)
396
-
397
- if not recycled:
398
- await self.http_beforeResponse(protocol)
399
- if self._app.signal.http_beforeResponse.receivers:
400
- await self._app.signal.http_beforeResponse.send_async(**{
401
- 'request': protocol.request,
402
- 'response': protocol.response,
403
- **protocol.kwargs
404
- })
405
-
406
403
  try:
407
404
  content, streamed = await protocol.response()
408
405
  protocol.transport.write(content)
@@ -22,7 +22,10 @@ class Workspace:
22
22
 
23
23
  @base.setter
24
24
  def base(self, value: str):
25
- sys.path.remove(self._base)
25
+ try:
26
+ sys.path.remove(self._base)
27
+ except:
28
+ ...
26
29
  self._base = value
27
30
  sys.path.append(self._base)
28
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: CheeseAPI
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: 一款web协程框架。
5
5
  Project-URL: Source, https://github.com/CheeseUnknown/CheeseAPI
6
6
  Author-email: Cheese Unknown <cheese@cheese.ren>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "CheeseAPI"
7
- version = "0.4.7"
7
+ version = "0.4.9"
8
8
  description = "一款web协程框架。"
9
9
  readme = "README.md"
10
10
  license-files = { paths = [ "LICENSE" ] }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes