brilliance-admin 0.43.4__py3-none-any.whl → 0.43.6__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.
@@ -54,7 +54,7 @@ class SQLAlchemyJWTAdminAuthentication(AdminAuthentication):
54
54
  logger.exception(
55
55
  'SQLAlchemy %s login db error: %s', type(self).__name__, e,
56
56
  )
57
- msg = _('connection_refused_error') % {'error': str(e)}
57
+ msg = _('errors.connection_refused_error') % {'error': str(e)}
58
58
  raise AdminAPIException(
59
59
  APIError(message=msg, code='connection_refused_error'),
60
60
  status_code=500,
@@ -127,7 +127,7 @@ class SQLAlchemyJWTAdminAuthentication(AdminAuthentication):
127
127
  logger.exception(
128
128
  'SQLAlchemy %s authenticate db error: %s', type(self).__name__, e,
129
129
  )
130
- msg = _('connection_refused_error') % {'error': str(e)}
130
+ msg = _('errors.connection_refused_error') % {'error': str(e)}
131
131
  raise AdminAPIException(
132
132
  APIError(message=msg, code='connection_refused_error'),
133
133
  status_code=500,
@@ -146,16 +146,15 @@ class SQLAlchemyRelatedField(TableField):
146
146
  if record is None:
147
147
  raise FieldError(f'Missing record in serialize context in value: {value}')
148
148
 
149
+ related = getattr(record, self.rel_name, None)
150
+
149
151
  if self.many:
150
- related = getattr(record, self.rel_name, None)
151
152
  if related is None:
152
- raise FieldError(f'Related field "{self.rel_name}" is missing on record "{record}" (many=True)')
153
-
153
+ raise FieldError(f'Many Related field "{self.rel_name}" is missing on record "{record}"')
154
154
  return [{'key': get_pk(obj), 'title': str(obj)} for obj in related]
155
155
 
156
- related = getattr(record, self.rel_name, None)
157
156
  if related is None:
158
- raise FieldError(f'Related field "{self.rel_name}" is missing on record "{record}" (many=False)')
157
+ return None
159
158
 
160
159
  return {'key': get_pk(related), 'title': str(related)}
161
160
 
@@ -18,7 +18,7 @@ class SQLAlchemyAdminCreate:
18
18
  language_context: LanguageContext,
19
19
  ) -> schema.CreateResult:
20
20
  if not self.has_create:
21
- raise AdminAPIException(APIError(message=_('method_not_allowed')), status_code=500)
21
+ raise AdminAPIException(APIError(message=_('errors.method_not_allowed')), status_code=500)
22
22
 
23
23
  # pylint: disable=import-outside-toplevel
24
24
  from sqlalchemy.exc import IntegrityError
@@ -37,7 +37,7 @@ class SQLAlchemyAdminCreate:
37
37
  type(self).__name__, self.table_schema.model.__name__, e,
38
38
  extra={'data': data},
39
39
  )
40
- msg = _('connection_refused_error') % {'error': str(e)}
40
+ msg = _('errors.connection_refused_error') % {'error': str(e)}
41
41
  raise AdminAPIException(
42
42
  APIError(message=msg, code='connection_refused_error'),
43
43
  status_code=500,
@@ -62,7 +62,7 @@ class SQLAlchemyAdminCreate:
62
62
  extra={'data': data},
63
63
  )
64
64
  raise AdminAPIException(
65
- APIError(message=_('db_error_create'), code='db_error_create'), status_code=500,
65
+ APIError(message=_('errors.db_error_create'), code='db_error_create'), status_code=500,
66
66
  ) from e
67
67
 
68
68
  logger.info(
@@ -14,5 +14,5 @@ class SQLAlchemyDeleteAction:
14
14
  )
15
15
  async def delete(self, action_data: ActionData):
16
16
  if not self.has_delete:
17
- raise AdminAPIException(APIError(message=_('method_not_allowed')), status_code=500)
17
+ raise AdminAPIException(APIError(message=_('errors.method_not_allowed')), status_code=500)
18
18
  return ActionResult(message=ActionMessage(_('deleted_successfully')))
@@ -109,7 +109,7 @@ class SQLAlchemyAdminListMixin:
109
109
  'list_data': list_data,
110
110
  }
111
111
  )
112
- msg = _('filter_error') % {'error': e.message}
112
+ msg = _('errors.filter_error') % {'error': e.message}
113
113
  raise AdminAPIException(APIError(message=msg, code='filters_exception'), status_code=500) from e
114
114
 
115
115
  except Exception as e:
@@ -120,7 +120,7 @@ class SQLAlchemyAdminListMixin:
120
120
  'list_data': list_data,
121
121
  }
122
122
  )
123
- raise AdminAPIException(APIError(message=_('filters_exception'), code='filters_exception'), status_code=500) from e
123
+ raise AdminAPIException(APIError(message=_('errors.filters_exception'), code='filters_exception'), status_code=500) from e
124
124
 
125
125
  data = []
126
126
 
@@ -143,7 +143,7 @@ class SQLAlchemyAdminListMixin:
143
143
  'list_data': list_data,
144
144
  }
145
145
  )
146
- msg = _('connection_refused_error') % {'error': str(e)}
146
+ msg = _('errors.connection_refused_error') % {'error': str(e)}
147
147
  raise AdminAPIException(
148
148
  APIError(message=msg, code='connection_refused_error'),
149
149
  status_code=500,
@@ -172,7 +172,7 @@ class SQLAlchemyAdminListMixin:
172
172
  }
173
173
  )
174
174
  raise AdminAPIException(
175
- APIError(message=_('db_error_list'), code='db_error_list'), status_code=500,
175
+ APIError(message=_('errors.db_error_list'), code='db_error_list'), status_code=500,
176
176
  ) from e
177
177
 
178
178
  return schema.TableListResult(data=data, total_count=int(total_count or 0))
@@ -1,7 +1,7 @@
1
1
  from typing import Any
2
2
 
3
3
  from brilliance_admin import auth, schema
4
- from brilliance_admin.exceptions import AdminAPIException, APIError
4
+ from brilliance_admin.exceptions import AdminAPIException, APIError, FieldError
5
5
  from brilliance_admin.integrations.sqlalchemy.fields_schema import SQLAlchemyFieldsSchema
6
6
  from brilliance_admin.translations import LanguageContext
7
7
  from brilliance_admin.translations import TranslateText as _
@@ -22,7 +22,7 @@ class SQLAlchemyAdminRetrieveMixin:
22
22
  language_context: LanguageContext,
23
23
  ) -> schema.RetrieveResult:
24
24
  if not self.has_delete:
25
- raise AdminAPIException(APIError(message=_('method_not_allowed')), status_code=500)
25
+ raise AdminAPIException(APIError(message=_('errors.method_not_allowed')), status_code=500)
26
26
 
27
27
  # pylint: disable=import-outside-toplevel
28
28
  from sqlalchemy import inspect
@@ -41,16 +41,25 @@ class SQLAlchemyAdminRetrieveMixin:
41
41
  extra={"record": record, "user": user},
42
42
  )
43
43
 
44
+ except FieldError as e:
45
+ logger.exception(
46
+ 'SQLAlchemy %s retrieve %s #%s field error: %s',
47
+ type(self).__name__, self.model.__name__, pk, e,
48
+ )
49
+ msg = _('errors.serialize_field_error') % {'error': e.message}
50
+ raise AdminAPIException(APIError(message=msg, code='filters_exception'), status_code=500) from e
51
+
44
52
  except Exception as e:
45
53
  logger.exception(
46
- 'SQLAlchemy %s retrieve db error: %s', type(self).__name__, e,
54
+ 'SQLAlchemy %s retrieve %s #%s db error: %s',
55
+ type(self).__name__, self.model.__name__, pk, e,
47
56
  )
48
57
  raise AdminAPIException(
49
- APIError(message=_('db_error_retrieve'), code='db_error_retrieve'), status_code=500,
58
+ APIError(message=_('errors.db_error_retrieve'), code='db_error_retrieve'), status_code=500,
50
59
  ) from e
51
60
 
52
61
  if record is None:
53
- msg = _('record_not_found') % {'pk_name': self.pk_name, 'pk': pk}
62
+ msg = _('errors.record_not_found') % {'pk_name': self.pk_name, 'pk': pk}
54
63
  raise AdminAPIException(
55
64
  APIError(message=msg, code='record_not_found'),
56
65
  status_code=400,
@@ -21,7 +21,7 @@ class SQLAlchemyAdminUpdate:
21
21
  language_context: LanguageContext,
22
22
  ) -> schema.UpdateResult:
23
23
  if not self.has_update:
24
- raise AdminAPIException(APIError(message=_('method_not_allowed')), status_code=500)
24
+ raise AdminAPIException(APIError(message=_('errors.method_not_allowed')), status_code=500)
25
25
 
26
26
  # pylint: disable=import-outside-toplevel
27
27
  from sqlalchemy import inspect
@@ -29,7 +29,7 @@ class SQLAlchemyAdminUpdate:
29
29
 
30
30
  if pk is None:
31
31
  raise AdminAPIException(
32
- APIError(message=_('pk_not_found') % {'pk_name': self.pk_name}, code='pk_not_found'),
32
+ APIError(message=_('errors.pk_not_found') % {'pk_name': self.pk_name}, code='pk_not_found'),
33
33
  status_code=400,
34
34
  )
35
35
 
@@ -42,7 +42,7 @@ class SQLAlchemyAdminUpdate:
42
42
  async with self.db_async_session() as session:
43
43
  record = (await session.execute(stmt)).scalars().first()
44
44
  if record is None:
45
- msg = _('record_not_found') % {'pk_name': self.pk_name, 'pk': pk}
45
+ msg = _('errors.record_not_found') % {'pk_name': self.pk_name, 'pk': pk}
46
46
  raise AdminAPIException(
47
47
  APIError(message=msg, code='record_not_found'),
48
48
  status_code=400,
@@ -59,7 +59,7 @@ class SQLAlchemyAdminUpdate:
59
59
  type(self).__name__, self.table_schema.model.__name__, pk, e,
60
60
  extra={'data': data},
61
61
  )
62
- msg = _('connection_refused_error') % {'error': str(e)}
62
+ msg = _('errors.connection_refused_error') % {'error': str(e)}
63
63
  raise AdminAPIException(
64
64
  APIError(message=msg, code='connection_refused_error'),
65
65
  status_code=400,
@@ -84,7 +84,7 @@ class SQLAlchemyAdminUpdate:
84
84
  extra={'data': data}
85
85
  )
86
86
  raise AdminAPIException(
87
- APIError(message=_('db_error_update'), code='db_error_update'), status_code=500,
87
+ APIError(message=_('errors.db_error_update'), code='db_error_update'), status_code=500,
88
88
  ) from e
89
89
 
90
90
  logger.info(
@@ -1,13 +1,19 @@
1
1
  delete: 'Delete'
2
2
  delete_confirmation_text: "Are you sure you want to delete those records?\nThis action cannot be undone."
3
3
  deleted_successfully: 'The entries were successfully deleted.'
4
- pk_not_found: 'The "%(pk_name)s" field was not found in the submitted data.'
5
- record_not_found: 'No record found for %(pk_name)s=%(pk)s.'
6
- db_error_create: 'Error creating a record in the database.'
7
- db_error_update: 'Error updating the record in the database.'
8
- db_error_retrieve: 'Error retrieving the record from the database.'
9
- db_error_list: 'Failed to retrieve table data from the database.'
10
- connection_refused_error: 'Database connection error: %(error)s'
4
+
5
+ errors:
6
+ db_error_create: 'Error creating a record in the database.'
7
+ db_error_update: 'Error updating the record in the database.'
8
+ db_error_retrieve: 'Error retrieving the record from the database.'
9
+ db_error_list: 'Failed to retrieve table data from the database.'
10
+ pk_not_found: 'The "%(pk_name)s" field was not found in the submitted data.'
11
+ record_not_found: 'No record found for %(pk_name)s=%(pk)s.'
12
+ connection_refused_error: 'Database connection error: %(error)s'
13
+ filters_exception: 'An unknown technical error occurred while filtering data.'
14
+ method_not_allowed: 'Error, method not allowed. This action is not permitted.'
15
+ filter_error: 'An error occurred during filtering: {error}'
16
+
11
17
  search_help: 'Available search fields: %(fields)s'
12
18
  sqlalchemy_search_help: |
13
19
  <b>Available search fields:</b>
@@ -17,6 +23,3 @@ sqlalchemy_search_help: |
17
23
  <b>""</b> - quotes for exact match
18
24
  <b>%%</b> - any sequence of characters
19
25
  <b>_</b> - any single character
20
- filters_exception: 'An unknown technical error occurred while filtering data.'
21
- method_not_allowed: 'Error, method not allowed. This action is not permitted.'
22
- filter_error: 'An error occurred during filtering: {error}'
@@ -1,13 +1,20 @@
1
1
  delete: 'Удалить'
2
2
  delete_confirmation_text: "Вы уверены, что хотите удалить данные записи?\nДанное действие нельзя отменить."
3
3
  deleted_successfully: 'Записи успешно удалены.'
4
- pk_not_found: 'Поле "%(pk_name)s" не найдено среди переданных данных.'
5
- record_not_found: 'Запись по ключу %(pk_name)s=%(pk)s не найдена.'
6
- db_error_create: 'Ошибка создания записи в базе данных.'
7
- db_error_update: 'Ошибка обновления записи в базе данных.'
8
- db_error_retrieve: 'Ошибка получения записи из базы данных.'
9
- db_error_list: 'Ошибка получения данных таблицы из базы данных.'
10
- connection_refused_error: 'Ошибка подключения к базе данных: %(error)s'
4
+
5
+ errors:
6
+ pk_not_found: 'Поле "%(pk_name)s" не найдено среди переданных данных.'
7
+ record_not_found: 'Запись по ключу %(pk_name)s=%(pk)s не найдена.'
8
+ db_error_create: 'Ошибка создания записи в базе данных.'
9
+ db_error_update: 'Ошибка обновления записи в базе данных.'
10
+ db_error_retrieve: 'Ошибка получения записи из базы данных.'
11
+ db_error_list: 'Ошибка получения данных таблицы из базы данных.'
12
+ connection_refused_error: 'Ошибка подключения к базе данных: %(error)s'
13
+ filters_exception: 'Произошла неизвестная техническая ошибка при фильтрации данных.'
14
+ method_not_allowed: 'Ошибка, данный метод недоступен.'
15
+ filter_error: 'Проишла ошибка при фильтрации: %(error)s'
16
+ serialize_field_error: 'Ошибка чтения данных: %(error)s'
17
+
11
18
  search_help: 'Доступные поля для поиска: %(fields)s'
12
19
  sqlalchemy_search_help: |
13
20
  <b>Доступные поля для поиска:</b>
@@ -17,6 +24,3 @@ sqlalchemy_search_help: |
17
24
  <b>""</b> - кавычки для точного совпадения
18
25
  <b>%%</b> - любая последовательность символов
19
26
  <b>_</b> - один любой символ
20
- filters_exception: 'Произошла неизвестная техническая ошибка при фильтрации данных.'
21
- method_not_allowed: 'Ошибка, данный метод недоступен.'
22
- filter_error: 'Проишла ошибка при фильтрации: {error}'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brilliance-admin
3
- Version: 0.43.4
3
+ Version: 0.43.6
4
4
  Summary: Simple and lightweight admin panel framework powered by FastAPI and Vue3 Vuetify together.. Some call it heavenly in its brilliance.
5
5
  License-Expression: AGPL-3.0
6
6
  Requires-Python: >=3.10
@@ -17,19 +17,19 @@ brilliance_admin/api/views/settings.py,sha256=2A9suZQONEtW9LkFban29Fe5ipQaaGT0Cz
17
17
  brilliance_admin/api/views/table.py,sha256=29vLEwueHWBS8Dq6nBvujwy4CTs9v8ZcM1ErF9lYgIc,5932
18
18
  brilliance_admin/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  brilliance_admin/integrations/sqlalchemy/__init__.py,sha256=tIegMU2eIW_zA-PdblCXCjenHAY4sGBUWKuz97ns4gE,275
20
- brilliance_admin/integrations/sqlalchemy/auth.py,sha256=99O7zmhcKWB3cWGTbMd3OSyIJ81Vcfz7byDK6oLinm8,4910
20
+ brilliance_admin/integrations/sqlalchemy/auth.py,sha256=NvOLKeeSJuNTzFhisNO9R3sEmGRS8IQrCwghPrtuzaw,4924
21
21
  brilliance_admin/integrations/sqlalchemy/autocomplete.py,sha256=baRroMwGg35uR5zt-aiQc2-ugX4hpwNf79R6bZH9UX0,1416
22
- brilliance_admin/integrations/sqlalchemy/fields.py,sha256=giVCIixwHz1iHFYHdi39_s4zo9cSZA_0CUoEAJRUGps,9467
22
+ brilliance_admin/integrations/sqlalchemy/fields.py,sha256=YjJhJMoiAQk53J0O1ftWhrp3CFIfYwGzIRnvk7aD6lM,9315
23
23
  brilliance_admin/integrations/sqlalchemy/fields_schema.py,sha256=7WkOrt5dVvrsZppNZEZS8QaQPMSrfcWChwOaOFSRVOg,11419
24
24
  brilliance_admin/integrations/sqlalchemy/table/__init__.py,sha256=g_in2pLTi8UQnT5uNFA8mLW5mxlT84irQ7yVaP_OSS4,605
25
25
  brilliance_admin/integrations/sqlalchemy/table/base.py,sha256=-osqhTvqE7YcBxsAjqIUMWyYk1df04GIDmdvtieTXcg,4885
26
- brilliance_admin/integrations/sqlalchemy/table/create.py,sha256=z40PuKJYZ6goJdhsANVuEyTW1gh0PipCBdBSe5Ii5Tw,2693
27
- brilliance_admin/integrations/sqlalchemy/table/delete.py,sha256=Awv50IG7DQsYrHVlk4dtYBMwexmlO92xhMBgrgEDBgs,731
28
- brilliance_admin/integrations/sqlalchemy/table/list.py,sha256=--KVTLbuCr1fD79q0LXqlu6CuiYA3QhQj6rrdP7jR14,6692
29
- brilliance_admin/integrations/sqlalchemy/table/retrieve.py,sha256=ny60-YN_ndUyibVd5cwogEFKXtzguJmWas2_xoQk3vQ,2272
30
- brilliance_admin/integrations/sqlalchemy/table/update.py,sha256=AGEEbEsgKre784Dg4_kTKB6NfMwdAwNiMjm0ZKeg-LE,3543
31
- brilliance_admin/locales/en.yml,sha256=lCM58SoP4HExXFCTHpl8pYw82tH_8TvlrcCXZDXYb5c,1129
32
- brilliance_admin/locales/ru.yml,sha256=hXZwS71Z_aAyK9DB14pwmbtLI5xn6PvsnuLIZlEexbM,1661
26
+ brilliance_admin/integrations/sqlalchemy/table/create.py,sha256=QY_Hbn4iu6Kq7reFsEUC-isCvcDK6vU4n5F0Bo1EOEs,2714
27
+ brilliance_admin/integrations/sqlalchemy/table/delete.py,sha256=toH9at-MAWO46K_4YmvkOqXX2-cFANVVhAURiZ-dwWQ,738
28
+ brilliance_admin/integrations/sqlalchemy/table/list.py,sha256=WPH4GoLrIU-TcGMrNoq46i3sJIz6vV76UaacmtG3Ytk,6720
29
+ brilliance_admin/integrations/sqlalchemy/table/retrieve.py,sha256=O6mJ_XxfLJ59Hx_V5VdAZNxObkY6p5L7gZED8QGXfy0,2744
30
+ brilliance_admin/integrations/sqlalchemy/table/update.py,sha256=RfIXTQHHEoZCrOtVeOxZ3ql0-is5czsgVAfO_1_gF7w,3578
31
+ brilliance_admin/locales/en.yml,sha256=hq4ktzZZYmfbI7RVHHwvkUD9qjETMW1Fq2DQPCQAPao,1159
32
+ brilliance_admin/locales/ru.yml,sha256=ySYstybcfNhWUgdYeTnepaddgOlPTu4cIAWKLAVYLeo,1770
33
33
  brilliance_admin/schema/__init__.py,sha256=X-izShvv84jkFU47WfpUwtvRh3NOv570iUB3NRNEIDU,248
34
34
  brilliance_admin/schema/admin_schema.py,sha256=fKVtaLkFkDF8ZkjIftackZ4rfCDcqLvci8PO6ZLycgc,6393
35
35
  brilliance_admin/schema/category.py,sha256=hkE4BJQeNbjtuloIgkNEy8Fz068lcMK98-lnZADClg4,4070
@@ -67,8 +67,8 @@ brilliance_admin/static/tinymce/plugins/codesample/css/prism.css,sha256=exAdMtHb
67
67
  brilliance_admin/static/tinymce/plugins/customLink/plugin.js,sha256=illBNpnHDkBsLG6wo_jDPF6z7CGnO1MQWUoDwZKy6vQ,5589
68
68
  brilliance_admin/static/tinymce/plugins/customLink/css/link.css,sha256=gh5nvY8Z92hJfCEBPnIm4jIPCcKKbJnab-30oIfX7Hc,56
69
69
  brilliance_admin/templates/index.html,sha256=ZLJ_TKUvBDIo_hYfbW43ov0S_bFrzBF-283XP6BKtDI,1294
70
- brilliance_admin-0.43.4.dist-info/licenses/LICENSE,sha256=PjeDRXGbVLtKul5Xpfco_6CyB6bYGWVVPrO0oubquuM,727
71
- brilliance_admin-0.43.4.dist-info/METADATA,sha256=XowThszR-MHi2j4ceq8Otv64Kq6qMFDsUAnAB9L0IO0,7459
72
- brilliance_admin-0.43.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- brilliance_admin-0.43.4.dist-info/top_level.txt,sha256=almFFSWrVYieI3i54hYL0fMUaeuIYiazS2Kx4wtK-ns,17
74
- brilliance_admin-0.43.4.dist-info/RECORD,,
70
+ brilliance_admin-0.43.6.dist-info/licenses/LICENSE,sha256=PjeDRXGbVLtKul5Xpfco_6CyB6bYGWVVPrO0oubquuM,727
71
+ brilliance_admin-0.43.6.dist-info/METADATA,sha256=rUACoUjEY-Zumi8JUI_EMVdzpyRix-JdKKvNQ-enI2Y,7459
72
+ brilliance_admin-0.43.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ brilliance_admin-0.43.6.dist-info/top_level.txt,sha256=almFFSWrVYieI3i54hYL0fMUaeuIYiazS2Kx4wtK-ns,17
74
+ brilliance_admin-0.43.6.dist-info/RECORD,,