fastapi-rtk 1.0.20__tar.gz → 1.0.21__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.
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/PKG-INFO +1 -1
- fastapi_rtk-1.0.21/fastapi_rtk/_version.py +1 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/api/model_rest_api.py +37 -30
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/file_manager.py +1 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/file_managers/s3_file_manager.py +22 -12
- fastapi_rtk-1.0.20/fastapi_rtk/_version.py +0 -1
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/.gitignore +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/LICENSE +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/README.md +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/api/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/api/base_api.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/apis.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/auth.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/hashers/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/hashers/pbkdf2.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/hashers/scrypt.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/hashers/utils.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/password_helpers/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/password_helpers/fab.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/strategies/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/strategies/config.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/strategies/db.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/auth/strategies/jwt.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/column.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/db.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/exceptions.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/filters.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/interface.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/model.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/generic/session.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/column.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/db.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/exceptions.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/audit.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/types.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/geoalchemy2/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/geoalchemy2/filters.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/geoalchemy2/geometry_converter.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/filters.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/interface.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/model.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/session.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/db.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/filter.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/interface.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/model.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/bases/session.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/cli.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/README +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/alembic.ini.mako +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/env.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/script.py.mako +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi-multidb/README +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi-multidb/alembic.ini.mako +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi-multidb/env.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi-multidb/script.py.mako +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/export.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/security.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/translate.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/const.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/decorators.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/types.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/utils.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/config.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/const.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/db.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/decorators.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/dependencies.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/exceptions.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/fastapi_react_toolkit.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/file_managers/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/file_managers/file_manager.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/file_managers/image_manager.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/file_managers/s3_image_manager.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/filters.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/globals.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/babel/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/babel/cli.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/babel/config.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/babel.cfg +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/lazy_text.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/messages.pot +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/de/LC_MESSAGES/messages.mo +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/de/LC_MESSAGES/messages.po +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/en/LC_MESSAGES/messages.mo +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/en/LC_MESSAGES/messages.po +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/manager.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/middlewares.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/mixins.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/models.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/routers.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/schemas.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/security/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/security/sqla/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/security/sqla/apis.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/security/sqla/models.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/security/sqla/security_manager.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/setting.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/types.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/__init__.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/async_task_runner.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/class_factory.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/csv_json_converter.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/deep_merge.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/extender_mixin.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/flask_appbuilder_utils.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/formatter.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/hooks.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/lazy.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/merge_schema.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/multiple_async_contexts.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/pydantic.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/run_utils.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/self_dependencies.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/smartdefaultdict.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/sqla.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/timezone.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/update_signature.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/use_default_when_none.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/utils/werkzeug.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/version.py +0 -0
- {fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-rtk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.21
|
|
4
4
|
Summary: A package that provides a set of tools to build a FastAPI application with a Class-Based CRUD API.
|
|
5
5
|
Project-URL: Homepage, https://codeberg.org/datatactics/fastapi-rtk
|
|
6
6
|
Project-URL: Issues, https://codeberg.org/datatactics/fastapi-rtk/issues
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.21"
|
|
@@ -1883,20 +1883,21 @@ class ModelRestApi(BaseApi):
|
|
|
1883
1883
|
if not isinstance(filenames, list):
|
|
1884
1884
|
filenames = [filenames]
|
|
1885
1885
|
for filename in filenames:
|
|
1886
|
-
old_content = await smart_run(fm.get_file, filename)
|
|
1887
1886
|
before_commit_runner.add_task(
|
|
1888
1887
|
lambda fm=fm, filename=filename: smart_run(
|
|
1889
1888
|
fm.delete_file, filename
|
|
1890
1889
|
)
|
|
1891
1890
|
)
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1891
|
+
if fm.file_exists(filename):
|
|
1892
|
+
old_content = await smart_run(fm.get_file, filename)
|
|
1893
|
+
after_commit_runner.add_task(
|
|
1894
|
+
lambda fm=fm,
|
|
1895
|
+
content=old_content,
|
|
1896
|
+
filename=filename: smart_run(
|
|
1897
|
+
fm.save_content_to_file, content, filename
|
|
1898
|
+
),
|
|
1899
|
+
tags=["file"],
|
|
1900
|
+
)
|
|
1900
1901
|
await smart_run(self.datamodel.delete, session, item)
|
|
1901
1902
|
after_commit_runner.remove_tasks_by_tag(
|
|
1902
1903
|
"file"
|
|
@@ -2410,21 +2411,26 @@ class ModelRestApi(BaseApi):
|
|
|
2410
2411
|
# Delete only the files or images that are not in the new old_filenames
|
|
2411
2412
|
for filename in actual_old_filenames:
|
|
2412
2413
|
if filename not in old_filenames:
|
|
2413
|
-
old_content = await smart_run(fm.get_file, filename)
|
|
2414
2414
|
before_commit_runner.add_task(
|
|
2415
2415
|
lambda fm=fm, old_filename=filename: smart_run(
|
|
2416
2416
|
fm.delete_file, old_filename
|
|
2417
2417
|
),
|
|
2418
2418
|
tags=["file"],
|
|
2419
2419
|
)
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2420
|
+
if fm.file_exists(filename):
|
|
2421
|
+
old_content = await smart_run(
|
|
2422
|
+
fm.get_file, filename
|
|
2423
|
+
)
|
|
2424
|
+
after_commit_runner.add_task(
|
|
2425
|
+
lambda fm=fm,
|
|
2426
|
+
content=old_content,
|
|
2427
|
+
filename=filename: smart_run(
|
|
2428
|
+
fm.save_content_to_file,
|
|
2429
|
+
content,
|
|
2430
|
+
filename,
|
|
2431
|
+
),
|
|
2432
|
+
tags=["file"],
|
|
2433
|
+
)
|
|
2428
2434
|
|
|
2429
2435
|
new_filenames = []
|
|
2430
2436
|
# Loop through value instead of only file values so the order is maintained
|
|
@@ -2440,27 +2446,28 @@ class ModelRestApi(BaseApi):
|
|
|
2440
2446
|
# Delete existing file or image if it is being updated
|
|
2441
2447
|
if item and hasattr(item, key) and getattr(item, key):
|
|
2442
2448
|
filename = getattr(item, key)
|
|
2443
|
-
old_content = await smart_run(fm.get_file, filename)
|
|
2444
2449
|
before_commit_runner = AsyncTaskRunner.get_runner(
|
|
2445
2450
|
"before_commit"
|
|
2446
2451
|
)
|
|
2447
|
-
after_commit_runner = AsyncTaskRunner.get_runner(
|
|
2448
|
-
"after_commit"
|
|
2449
|
-
)
|
|
2450
2452
|
before_commit_runner.add_task(
|
|
2451
2453
|
lambda fm=fm, old_filename=filename: smart_run(
|
|
2452
2454
|
fm.delete_file, old_filename
|
|
2453
2455
|
),
|
|
2454
2456
|
tags=["file"],
|
|
2455
2457
|
)
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2458
|
+
if fm.file_exists(filename):
|
|
2459
|
+
old_content = await smart_run(fm.get_file, filename)
|
|
2460
|
+
after_commit_runner = AsyncTaskRunner.get_runner(
|
|
2461
|
+
"after_commit"
|
|
2462
|
+
)
|
|
2463
|
+
after_commit_runner.add_task(
|
|
2464
|
+
lambda fm=fm,
|
|
2465
|
+
content=old_content,
|
|
2466
|
+
filename=filename: smart_run(
|
|
2467
|
+
fm.save_content_to_file, content, filename
|
|
2468
|
+
),
|
|
2469
|
+
tags=["file"],
|
|
2470
|
+
)
|
|
2464
2471
|
|
|
2465
2472
|
# Only process if the value exists and is not None
|
|
2466
2473
|
if value:
|
|
@@ -268,6 +268,7 @@ class AbstractFileManager(abc.ABC):
|
|
|
268
268
|
return self.__class__(
|
|
269
269
|
base_path=f"{self.base_path}/{subfolder}",
|
|
270
270
|
allowed_extensions=self.allowed_extensions,
|
|
271
|
+
max_file_size=self.max_file_size,
|
|
271
272
|
namegen=self.namegen,
|
|
272
273
|
permission=self.permission,
|
|
273
274
|
*args,
|
|
@@ -2,7 +2,7 @@ import typing
|
|
|
2
2
|
|
|
3
3
|
from ..bases.file_manager import AbstractFileManager
|
|
4
4
|
from ..setting import Setting
|
|
5
|
-
from ..utils import lazy, smart_run, use_default_when_none
|
|
5
|
+
from ..utils import T, lazy, smart_run, use_default_when_none
|
|
6
6
|
|
|
7
7
|
__all__ = ["S3FileManager"]
|
|
8
8
|
|
|
@@ -14,6 +14,7 @@ class S3FileManager(AbstractFileManager):
|
|
|
14
14
|
|
|
15
15
|
allowed_extensions = lazy(lambda: Setting.FILE_ALLOWED_EXTENSIONS)
|
|
16
16
|
max_file_size = lazy(lambda: Setting.FILE_MAX_SIZE)
|
|
17
|
+
ERROR_CODE_FILE_NOT_FOUND = "NoSuchKey"
|
|
17
18
|
|
|
18
19
|
def __init__(
|
|
19
20
|
self,
|
|
@@ -57,10 +58,14 @@ class S3FileManager(AbstractFileManager):
|
|
|
57
58
|
|
|
58
59
|
try:
|
|
59
60
|
import boto3
|
|
61
|
+
import botocore
|
|
62
|
+
import botocore.client
|
|
60
63
|
import smart_open
|
|
61
64
|
|
|
62
65
|
self.smart_open = smart_open
|
|
63
66
|
self.boto3 = boto3
|
|
67
|
+
self.botocore = botocore
|
|
68
|
+
self.botocore.client = botocore.client
|
|
64
69
|
except ImportError:
|
|
65
70
|
raise ImportError(
|
|
66
71
|
"smart_open is required for S3FileManager. "
|
|
@@ -125,27 +130,22 @@ class S3FileManager(AbstractFileManager):
|
|
|
125
130
|
return path
|
|
126
131
|
|
|
127
132
|
def delete_file(self, filename):
|
|
128
|
-
|
|
129
|
-
try:
|
|
130
|
-
self.smart_open.open(
|
|
131
|
-
path, "rb", **self.open_params
|
|
132
|
-
).close() # Check if file exists
|
|
133
|
+
if self.file_exists(filename):
|
|
133
134
|
self.boto3_client.delete_object(
|
|
134
135
|
Bucket=self.bucket_name,
|
|
135
136
|
Key=f"{self.bucket_subfolder}/{filename}"
|
|
136
137
|
if self.bucket_subfolder
|
|
137
138
|
else filename,
|
|
138
139
|
)
|
|
139
|
-
except FileNotFoundError:
|
|
140
|
-
pass
|
|
141
140
|
|
|
142
141
|
def file_exists(self, filename):
|
|
143
142
|
path = self.get_path(filename)
|
|
144
143
|
try:
|
|
145
|
-
with self.smart_open.open(path, "rb", **self.open_params):
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
with self.smart_open.open(path, "rb", **self.open_params) as f:
|
|
145
|
+
f.read(1) # Try to read a byte to confirm existence
|
|
146
|
+
return True
|
|
147
|
+
except IOError as e:
|
|
148
|
+
return self._handle_io_error(e, value_to_return=False)
|
|
149
149
|
|
|
150
150
|
def get_instance_with_subfolder(self, subfolder, *args, **kwargs):
|
|
151
151
|
return super().get_instance_with_subfolder(
|
|
@@ -161,3 +161,13 @@ class S3FileManager(AbstractFileManager):
|
|
|
161
161
|
*args,
|
|
162
162
|
**kwargs,
|
|
163
163
|
)
|
|
164
|
+
|
|
165
|
+
def _handle_io_error(self, e: IOError, *, value_to_return: T = None):
|
|
166
|
+
if hasattr(e, "backend_error") and isinstance(
|
|
167
|
+
e.backend_error, self.botocore.client.ClientError
|
|
168
|
+
):
|
|
169
|
+
error = e.backend_error.response.get("Error", {})
|
|
170
|
+
error_code = error.get("Code")
|
|
171
|
+
if error_code == self.ERROR_CODE_FILE_NOT_FOUND:
|
|
172
|
+
return value_to_return
|
|
173
|
+
raise e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.20"
|
|
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
|
|
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
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/__init__.py
RENAMED
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/audit.py
RENAMED
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/backends/sqla/extensions/audit/types.py
RENAMED
|
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
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/README
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/cli/commands/db/templates/fastapi/env.py
RENAMED
|
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
|
|
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
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/de/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/de/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{fastapi_rtk-1.0.20 → fastapi_rtk-1.0.21}/fastapi_rtk/lang/translations/en/LC_MESSAGES/messages.po
RENAMED
|
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
|
|
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
|