gomyck-tools 1.5.1__py3-none-any.whl → 1.5.3__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 +6 -1
- {gomyck_tools-1.5.1.dist-info → gomyck_tools-1.5.3.dist-info}/METADATA +1 -1
- {gomyck_tools-1.5.1.dist-info → gomyck_tools-1.5.3.dist-info}/RECORD +7 -7
- {gomyck_tools-1.5.1.dist-info → gomyck_tools-1.5.3.dist-info}/WHEEL +0 -0
- {gomyck_tools-1.5.1.dist-info → gomyck_tools-1.5.3.dist-info}/licenses/LICENSE +0 -0
- {gomyck_tools-1.5.1.dist-info → gomyck_tools-1.5.3.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
|
@@ -127,11 +127,16 @@ class CBottle:
|
|
|
127
127
|
def enable_spa_mode(self):
|
|
128
128
|
@self.bottle.error(404)
|
|
129
129
|
def error_404_handler(error):
|
|
130
|
-
if request.path.startswith('/api/'):
|
|
130
|
+
if request.path.startswith('/api/'):
|
|
131
|
+
response.status = 404
|
|
132
|
+
return R.error(resp=R.Code.cus_code(404, "资源未找到: {}".format(error.body)))
|
|
131
133
|
return static_file(filename=self.index_filename, root=self.index_root)
|
|
132
134
|
|
|
133
135
|
@self.bottle.error(401)
|
|
134
136
|
def unauthorized(error):
|
|
137
|
+
if request.path.startswith('/api/'):
|
|
138
|
+
response.status = 401
|
|
139
|
+
return R.error(resp=R.Code.cus_code(401, "系统未授权! {}".format(error.body)))
|
|
135
140
|
response.status=301
|
|
136
141
|
response.set_header('Location', urljoin(request.url, '/'))
|
|
137
142
|
return response
|
|
@@ -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=0NzojpVL6_dBiY6tjrNtMFyu2-q1pKox4o9WDeAIQzE,7057
|
|
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.3.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
|
|
85
|
+
gomyck_tools-1.5.3.dist-info/METADATA,sha256=KU20PViB_EpAe3T8nFoHj77sXESeN3r7IAm53yK6mhU,1826
|
|
86
|
+
gomyck_tools-1.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
87
|
+
gomyck_tools-1.5.3.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
|
|
88
|
+
gomyck_tools-1.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|