CheeseAPI 1.2.0__tar.gz → 1.2.1__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.
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/handle.py +1 -1
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/protocol.py +0 -3
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/response.py +1 -1
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/validator.py +5 -4
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/PKG-INFO +1 -1
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/pyproject.toml +1 -1
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/.gitignore +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/__init__.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/app.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/cors.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/exception.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/file.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/request.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/route.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/schedule.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/server.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/signal.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/text.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/websocket.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/CheeseAPI/workspace.py +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/LICENSE +0 -0
- {cheeseapi-1.2.0 → cheeseapi-1.2.1}/README.md +0 -0
|
@@ -361,7 +361,7 @@ class Handle:
|
|
|
361
361
|
|
|
362
362
|
async def http_static(self, protocol: 'HttpProtocol'):
|
|
363
363
|
if self._app.server.static and self._app.workspace.static and protocol.request.path.startswith(self._app.server.static) and protocol.request.method == http.HTTPMethod.GET:
|
|
364
|
-
for key in [ '', '.html', '
|
|
364
|
+
for key in [ '', '.html', '/index.html' ]:
|
|
365
365
|
try:
|
|
366
366
|
protocol.response = FileResponse(os.path.join(self._app.workspace.static, protocol.request.path[1:] + key))
|
|
367
367
|
|
|
@@ -54,9 +54,6 @@ class HttpProtocol(asyncio.Protocol):
|
|
|
54
54
|
t.split('=')[0]: t.split('=')[1] for t in self.request.headers['Cookie'].split('; ')
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if not self.parser.should_upgrade() and not int(self.request.headers.get('Content-Length', 0)):
|
|
58
|
-
asyncio.get_event_loop().create_task(app._handle.http(self))
|
|
59
|
-
|
|
60
57
|
def on_body(self, body: bytes):
|
|
61
58
|
if self.request.body is None:
|
|
62
59
|
self.request._body = b''
|
|
@@ -397,7 +397,7 @@ class BaseResponse:
|
|
|
397
397
|
elif isinstance(self.body, str):
|
|
398
398
|
_value = self.body.encode()
|
|
399
399
|
elif isinstance(self.body, bytes):
|
|
400
|
-
_value
|
|
400
|
+
_value = self.body
|
|
401
401
|
if _value:
|
|
402
402
|
value += b'%x\r\n' % len(_value) + _value + b'\r\n0\r\n\r\n'
|
|
403
403
|
|
|
@@ -40,7 +40,7 @@ class Validator:
|
|
|
40
40
|
*,
|
|
41
41
|
required: bool = False,
|
|
42
42
|
default: Any = None,
|
|
43
|
-
type: List[object | Callable] | object | Callable =
|
|
43
|
+
type: List[object | Callable] | object | Callable = None,
|
|
44
44
|
expected_type: str | None = None,
|
|
45
45
|
pattern: str | None = None,
|
|
46
46
|
min: object | None = None,
|
|
@@ -101,7 +101,7 @@ class Validator:
|
|
|
101
101
|
self._scope: Literal['form', 'headers', 'args', 'path', 'cookie'] = scope
|
|
102
102
|
self.key: str = key
|
|
103
103
|
self._type: List[object | Callable] | object | Callable = type
|
|
104
|
-
self._expected_type: str = type.__name__ if expected_type is None else expected_type
|
|
104
|
+
self._expected_type: str | None = type.__name__ if expected_type is None and self._type is not None else expected_type
|
|
105
105
|
self.required: bool = required
|
|
106
106
|
self._default: Any = default
|
|
107
107
|
self._pattern: str | None = pattern
|
|
@@ -124,7 +124,8 @@ class Validator:
|
|
|
124
124
|
if self.required:
|
|
125
125
|
raise ValidateError(self.response or Response(app._text.validator_requiredMessage(self.scope, self.key), 400))
|
|
126
126
|
validatedForm[f'{self.scope}.{self.key}'] = self.default
|
|
127
|
-
|
|
127
|
+
|
|
128
|
+
if validatedForm[f'{self.scope}.{self.key}'] is not None:
|
|
128
129
|
if self.type is not None:
|
|
129
130
|
try:
|
|
130
131
|
if isinstance(self.type, list):
|
|
@@ -203,7 +204,7 @@ class Validator:
|
|
|
203
204
|
|
|
204
205
|
@expected_type.setter
|
|
205
206
|
def expected_type(self, value: str | None):
|
|
206
|
-
self._expected_type = self.type.__name__ if value is None else value
|
|
207
|
+
self._expected_type = self.type.__name__ if value is None and self.type is not None else value
|
|
207
208
|
|
|
208
209
|
@property
|
|
209
210
|
def default(self) -> Any:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|