ezKit 1.12.40__tar.gz → 1.12.42__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.
Files changed (31) hide show
  1. {ezkit-1.12.40/ezKit.egg-info → ezkit-1.12.42}/PKG-INFO +1 -1
  2. ezkit-1.12.42/ezKit/auth.py +15 -0
  3. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/database.py +10 -2
  4. {ezkit-1.12.40 → ezkit-1.12.42/ezKit.egg-info}/PKG-INFO +1 -1
  5. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit.egg-info/SOURCES.txt +1 -0
  6. {ezkit-1.12.40 → ezkit-1.12.42}/setup.py +1 -1
  7. {ezkit-1.12.40 → ezkit-1.12.42}/LICENSE +0 -0
  8. {ezkit-1.12.40 → ezkit-1.12.42}/MANIFEST.in +0 -0
  9. {ezkit-1.12.40 → ezkit-1.12.42}/README.md +0 -0
  10. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/__init__.py +0 -0
  11. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/_file.py +0 -0
  12. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/bottle.py +0 -0
  13. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/bottle_extensions.py +0 -0
  14. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/cipher.py +0 -0
  15. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/dockerhub.py +0 -0
  16. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/errors.py +0 -0
  17. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/fastapix.py +0 -0
  18. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/http.py +0 -0
  19. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/markdown_to_html.template +0 -0
  20. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/mongo.py +0 -0
  21. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/qywx.py +0 -0
  22. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/redis.py +0 -0
  23. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/sendemail.py +0 -0
  24. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/token.py +0 -0
  25. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/utils.py +0 -0
  26. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/xftp.py +0 -0
  27. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit/zabbix.py +0 -0
  28. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit.egg-info/dependency_links.txt +0 -0
  29. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit.egg-info/requires.txt +0 -0
  30. {ezkit-1.12.40 → ezkit-1.12.42}/ezKit.egg-info/top_level.txt +0 -0
  31. {ezkit-1.12.40 → ezkit-1.12.42}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 1.12.40
3
+ Version: 1.12.42
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -0,0 +1,15 @@
1
+ import bcrypt
2
+
3
+
4
+ def hash_password(password: str) -> str:
5
+ try:
6
+ return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
7
+ except Exception as _:
8
+ return ""
9
+
10
+
11
+ def verify_password(plain_password: str, hashed_password: str) -> bool:
12
+ try:
13
+ return bcrypt.checkpw(plain_password.encode(), hashed_password.encode())
14
+ except Exception as _:
15
+ return False
@@ -25,7 +25,7 @@ from .errors import database_error, sqlalchemy_error
25
25
 
26
26
  # --------------------------------------------------------------------------------------------------
27
27
 
28
- Base = declarative_base()
28
+ Base: DeclarativeBase = declarative_base()
29
29
 
30
30
  # --------------------------------------------------------------------------------------------------
31
31
 
@@ -79,11 +79,19 @@ def orm_object_to_dict(obj, include: list | None = None) -> dict | None:
79
79
  data = {}
80
80
 
81
81
  for column in obj.__table__.columns:
82
+
82
83
  key = column.name
84
+
83
85
  if include and key not in include:
84
86
  continue
87
+
85
88
  value = getattr(obj, key)
86
- if isinstance(value, (datetime, date)):
89
+
90
+ if isinstance(value, str):
91
+ # 移除字符串前后的空白字符, 包括空格、\n、\t 等
92
+ data[key] = str(value).strip()
93
+ elif isinstance(value, (datetime, date)):
94
+ # 日期时间转换为可读的字符串
87
95
  # data[key] = value.isoformat()
88
96
  data[key] = value.strftime("%Y-%m-%d %H:%M:%S")
89
97
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 1.12.40
3
+ Version: 1.12.42
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -4,6 +4,7 @@ README.md
4
4
  setup.py
5
5
  ezKit/__init__.py
6
6
  ezKit/_file.py
7
+ ezKit/auth.py
7
8
  ezKit/bottle.py
8
9
  ezKit/bottle_extensions.py
9
10
  ezKit/cipher.py
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name="ezKit",
7
- version="1.12.40",
7
+ version="1.12.42",
8
8
  author="septvean",
9
9
  author_email="septvean@gmail.com",
10
10
  description="Easy Kit",
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
File without changes
File without changes
File without changes
File without changes