gomyck-tools 1.5.0__py3-none-any.whl → 1.5.2__py3-none-any.whl
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.
- ctools/cjson.py +8 -0
- ctools/web/bottle_webserver.py +7 -0
- {gomyck_tools-1.5.0.dist-info → gomyck_tools-1.5.2.dist-info}/METADATA +1 -1
- {gomyck_tools-1.5.0.dist-info → gomyck_tools-1.5.2.dist-info}/RECORD +7 -7
- {gomyck_tools-1.5.0.dist-info → gomyck_tools-1.5.2.dist-info}/WHEEL +0 -0
- {gomyck_tools-1.5.0.dist-info → gomyck_tools-1.5.2.dist-info}/licenses/LICENSE +0 -0
- {gomyck_tools-1.5.0.dist-info → gomyck_tools-1.5.2.dist-info}/top_level.txt +0 -0
ctools/cjson.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import decimal
|
|
2
|
+
|
|
1
3
|
import jsonpickle
|
|
4
|
+
from jsonpickle.handlers import BaseHandler
|
|
2
5
|
|
|
3
6
|
# 需要转换成str的属性
|
|
4
7
|
str_value_keys = []
|
|
@@ -6,6 +9,11 @@ jsonpickle.set_preferred_backend('json')
|
|
|
6
9
|
jsonpickle.set_encoder_options('json', ensure_ascii=False)
|
|
7
10
|
jsonpickle.set_decoder_options('json')
|
|
8
11
|
|
|
12
|
+
class DecimalHandler(BaseHandler):
|
|
13
|
+
def flatten(self, obj, data):
|
|
14
|
+
return float(obj) if obj is not None else 0
|
|
15
|
+
|
|
16
|
+
jsonpickle.handlers.register(decimal.Decimal, DecimalHandler)
|
|
9
17
|
|
|
10
18
|
def dumps(obj, **kwargs) -> str:
|
|
11
19
|
"""
|
ctools/web/bottle_webserver.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import sys
|
|
3
3
|
from socketserver import ThreadingMixIn
|
|
4
|
+
from urllib.parse import urljoin
|
|
4
5
|
from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
|
|
5
6
|
|
|
6
7
|
from bottle import ServerAdapter, Bottle, template, static_file, abort, redirect, response, request
|
|
@@ -129,6 +130,12 @@ class CBottle:
|
|
|
129
130
|
if request.path.startswith('/api/'): return R.error(resp=R.Code.cus_code(404, "资源未找到: {}".format(error.body)))
|
|
130
131
|
return static_file(filename=self.index_filename, root=self.index_root)
|
|
131
132
|
|
|
133
|
+
@self.bottle.error(401)
|
|
134
|
+
def unauthorized(error):
|
|
135
|
+
response.status=301
|
|
136
|
+
response.set_header('Location', urljoin(request.url, '/'))
|
|
137
|
+
return response
|
|
138
|
+
|
|
132
139
|
def set_index(self, filename='index.html', root='./', is_tpl=False, redirect_url=None, spa=False, **kwargs):
|
|
133
140
|
self.index_root = root
|
|
134
141
|
self.index_filename = filename
|
|
@@ -5,7 +5,7 @@ ctools/call.py,sha256=TFFC8PqvCu0PS0XelmV4QXdXezQiUsEacxg3RgKvdwE,1572
|
|
|
5
5
|
ctools/cdate.py,sha256=OhKAaQfo2Rxd3Jx3g9AfPsaISRoLkstqZdaGT4ZZr_I,3096
|
|
6
6
|
ctools/cdebug.py,sha256=_mihZRCEx_bi7Kv_QPjP4MPLNFrl-GR1Y_irTgOP7OU,4021
|
|
7
7
|
ctools/cid.py,sha256=utxK9u6Df1HuMaiQztqnJ5EENYaJHzZ0pCIuXpveckA,401
|
|
8
|
-
ctools/cjson.py,sha256=
|
|
8
|
+
ctools/cjson.py,sha256=A6jRvXUR75LaHCW02OnCraELAwwDv1dXnayCj1PXJSw,1608
|
|
9
9
|
ctools/cron_lite.py,sha256=rVu9S2oouaw_XZ5RMDJidCNepg5yoEJwLcfcaGTuJRA,8235
|
|
10
10
|
ctools/dict_wrapper.py,sha256=0NRtHUX7MVjfIyms_gJiofGcD-x4lBCnaSpkk5yDdjE,461
|
|
11
11
|
ctools/ex.py,sha256=9npepunW0G1obXqjnvUEiNAjQ5XDazZvEtlF5ceFRCM,869
|
|
@@ -75,14 +75,14 @@ ctools/web/__init__.py,sha256=koSNYeKF5Z_xbp4Q2qbZ4ZP-3--1phbOYN9e4SJy_gk,98
|
|
|
75
75
|
ctools/web/aio_web_server.py,sha256=p46BOU3_m4Jb57yAACeedKjhlFc1YC0QJSUe2selBgA,5693
|
|
76
76
|
ctools/web/api_result.py,sha256=i1MjTnnlgkWl_q07xr-TLQeLYlXEh4DEclUFE414nSk,1568
|
|
77
77
|
ctools/web/bottle_web_base.py,sha256=iQZJtRQH3HJ-P-48Gspvp1VEd6boAlZfiat3H8E5bBU,8763
|
|
78
|
-
ctools/web/bottle_webserver.py,sha256=
|
|
78
|
+
ctools/web/bottle_webserver.py,sha256=Gke_rjRrnUAl0rVe8rkTaq7SPrxb0cHKV_Ln6l7fqus,6854
|
|
79
79
|
ctools/web/bottle_websocket.py,sha256=xsu9fAtTuR5DsSsQjiBfaYxLjOWFyfr1sYM6cktTovI,1957
|
|
80
80
|
ctools/web/ctoken.py,sha256=WaB29kqGlKAh21aUw5avl2h8AgLD1aESw8KCpqaN5nM,2539
|
|
81
81
|
ctools/web/download_util.py,sha256=v0JTXiED1bvoWFfwfd-LD5s7_aoRQ0lCkaGwSnSp7WI,1954
|
|
82
82
|
ctools/web/params_util.py,sha256=eJDV3PSq-ZHb8UZf6xqs8kOhbyZzits1H9yPoUBIDXg,828
|
|
83
83
|
ctools/web/upload_util.py,sha256=z1QQCi4SFx08jrAQH5-Y_ShiM4MghuD_5Qz6V9KK_4U,1076
|
|
84
|
-
gomyck_tools-1.5.
|
|
85
|
-
gomyck_tools-1.5.
|
|
86
|
-
gomyck_tools-1.5.
|
|
87
|
-
gomyck_tools-1.5.
|
|
88
|
-
gomyck_tools-1.5.
|
|
84
|
+
gomyck_tools-1.5.2.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
|
|
85
|
+
gomyck_tools-1.5.2.dist-info/METADATA,sha256=g3hKnHGV8s5DRPzimxL0XBhLbvHelBTKi0fAhN_iwto,1826
|
|
86
|
+
gomyck_tools-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
87
|
+
gomyck_tools-1.5.2.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
|
|
88
|
+
gomyck_tools-1.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|