invenio-banners 3.1.1__tar.gz → 4.0.0__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.

Potentially problematic release.


This version of invenio-banners might be problematic. Click here for more details.

Files changed (127) hide show
  1. invenio_banners-4.0.0/.github/workflows/pypi-publish.yml +11 -0
  2. invenio_banners-4.0.0/.github/workflows/tests.yml +28 -0
  3. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/CHANGES.rst +10 -4
  4. invenio_banners-4.0.0/PKG-INFO +117 -0
  5. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/__init__.py +2 -1
  6. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/records/models.py +25 -26
  7. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/resources/errors.py +4 -4
  8. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/results.py +9 -1
  9. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/schemas.py +2 -2
  10. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/service.py +10 -5
  11. invenio_banners-4.0.0/invenio_banners.egg-info/PKG-INFO +117 -0
  12. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners.egg-info/entry_points.txt +0 -1
  13. invenio_banners-4.0.0/invenio_banners.egg-info/requires.txt +15 -0
  14. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/setup.cfg +8 -7
  15. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/resources/test_resources.py +55 -26
  16. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/services/test_services.py +12 -6
  17. invenio-banners-3.1.1/.github/workflows/pypi-publish.yml +0 -28
  18. invenio-banners-3.1.1/.github/workflows/tests.yml +0 -69
  19. invenio-banners-3.1.1/PKG-INFO +0 -100
  20. invenio-banners-3.1.1/invenio_banners.egg-info/PKG-INFO +0 -100
  21. invenio-banners-3.1.1/invenio_banners.egg-info/requires.txt +0 -14
  22. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.dockerignore +0 -0
  23. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.editorconfig +0 -0
  24. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.git-blame-ignore-revs +0 -0
  25. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.github/workflows/i18n-pull.yml +0 -0
  26. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.github/workflows/i18n-push.yml +0 -0
  27. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/.tx/config +0 -0
  28. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/AUTHORS.rst +0 -0
  29. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/CONTRIBUTING.rst +0 -0
  30. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/INSTALL.rst +0 -0
  31. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/LICENSE +0 -0
  32. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/MANIFEST.in +0 -0
  33. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/README.rst +0 -0
  34. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/babel.ini +0 -0
  35. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/Makefile +0 -0
  36. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/api.rst +0 -0
  37. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/authors.rst +0 -0
  38. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/changes.rst +0 -0
  39. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/conf.py +0 -0
  40. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/configuration.rst +0 -0
  41. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/contributing.rst +0 -0
  42. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/index.rst +0 -0
  43. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/installation.rst +0 -0
  44. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/license.rst +0 -0
  45. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/make.bat +0 -0
  46. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/requirements.txt +0 -0
  47. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/docs/usage.rst +0 -0
  48. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/administration/__init__.py +0 -0
  49. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/administration/banners.py +0 -0
  50. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/alembic/5e02314da32e_create_invenio_banners_db_table.py +0 -0
  51. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/alembic/e40d93d99040_create_invenio_banners_branch.py +0 -0
  52. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/config.py +0 -0
  53. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/ext.py +0 -0
  54. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/proxies.py +0 -0
  55. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/records/__init__.py +0 -0
  56. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/resources/__init__.py +0 -0
  57. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/resources/config.py +0 -0
  58. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/resources/resource.py +0 -0
  59. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/__init__.py +0 -0
  60. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/config.py +0 -0
  61. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/errors.py +0 -0
  62. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/services/permissions.py +0 -0
  63. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/templates/semantic-ui/invenio_banners/banner.html +0 -0
  64. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/af/LC_MESSAGES/messages.po +0 -0
  65. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ar/LC_MESSAGES/messages.po +0 -0
  66. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/bg/LC_MESSAGES/messages.po +0 -0
  67. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ca/LC_MESSAGES/messages.po +0 -0
  68. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/cs/LC_MESSAGES/messages.po +0 -0
  69. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/da/LC_MESSAGES/messages.po +0 -0
  70. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/de/LC_MESSAGES/messages.po +0 -0
  71. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/de_AT/LC_MESSAGES/messages.po +0 -0
  72. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/de_DE/LC_MESSAGES/messages.po +0 -0
  73. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/el/LC_MESSAGES/messages.po +0 -0
  74. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/en_AT/LC_MESSAGES/messages.po +0 -0
  75. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/en_HU/LC_MESSAGES/messages.po +0 -0
  76. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/es/LC_MESSAGES/messages.po +0 -0
  77. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/es_CU/LC_MESSAGES/messages.po +0 -0
  78. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/es_MX/LC_MESSAGES/messages.po +0 -0
  79. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/et/LC_MESSAGES/messages.po +0 -0
  80. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/et_EE/LC_MESSAGES/messages.po +0 -0
  81. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/fa/LC_MESSAGES/messages.po +0 -0
  82. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/fa_IR/LC_MESSAGES/messages.po +0 -0
  83. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/fr/LC_MESSAGES/messages.po +0 -0
  84. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/fr_CI/LC_MESSAGES/messages.po +0 -0
  85. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/fr_FR/LC_MESSAGES/messages.po +0 -0
  86. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/gl/LC_MESSAGES/messages.po +0 -0
  87. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/hi_IN/LC_MESSAGES/messages.po +0 -0
  88. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/hr/LC_MESSAGES/messages.po +0 -0
  89. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/hu/LC_MESSAGES/messages.po +0 -0
  90. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/hu_HU/LC_MESSAGES/messages.po +0 -0
  91. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/it/LC_MESSAGES/messages.po +0 -0
  92. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ja/LC_MESSAGES/messages.po +0 -0
  93. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ka/LC_MESSAGES/messages.po +0 -0
  94. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/lt/LC_MESSAGES/messages.po +0 -0
  95. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/messages.pot +0 -0
  96. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ne/LC_MESSAGES/messages.po +0 -0
  97. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/no/LC_MESSAGES/messages.po +0 -0
  98. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/pl/LC_MESSAGES/messages.po +0 -0
  99. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/pt/LC_MESSAGES/messages.po +0 -0
  100. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ro/LC_MESSAGES/messages.po +0 -0
  101. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/ru/LC_MESSAGES/messages.po +0 -0
  102. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/rw/LC_MESSAGES/messages.po +0 -0
  103. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/sk/LC_MESSAGES/messages.po +0 -0
  104. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/sv/LC_MESSAGES/messages.po +0 -0
  105. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/sv_SE/LC_MESSAGES/messages.po +0 -0
  106. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/tr/LC_MESSAGES/messages.po +0 -0
  107. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/uk/LC_MESSAGES/messages.po +0 -0
  108. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/uk_UA/LC_MESSAGES/messages.po +0 -0
  109. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/zh_CN/LC_MESSAGES/messages.po +0 -0
  110. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/translations/zh_TW/LC_MESSAGES/messages.po +0 -0
  111. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/utils.py +0 -0
  112. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners/views.py +0 -0
  113. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners.egg-info/SOURCES.txt +0 -0
  114. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners.egg-info/dependency_links.txt +0 -0
  115. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners.egg-info/not-zip-safe +0 -0
  116. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/invenio_banners.egg-info/top_level.txt +0 -0
  117. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/pyproject.toml +0 -0
  118. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/requirements-devel.txt +0 -0
  119. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/run-tests.sh +0 -0
  120. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/setup.py +0 -0
  121. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/conftest.py +0 -0
  122. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/records/test_disable.py +0 -0
  123. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/records/test_models.py +0 -0
  124. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/resources/conftest.py +0 -0
  125. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/services/conftest.py +0 -0
  126. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/test_invenio_banners.py +0 -0
  127. {invenio-banners-3.1.1 → invenio_banners-4.0.0}/tests/test_macro.py +0 -0
@@ -0,0 +1,11 @@
1
+ on:
2
+ push:
3
+ tags:
4
+ - v*
5
+
6
+ jobs:
7
+ build-n-publish:
8
+ uses: inveniosoftware/workflows/.github/workflows/pypi-publish.yml@master
9
+ secrets: inherit
10
+ with:
11
+ babel-compile-catalog: true
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file is part of Invenio.
4
+ # Copyright (C) 2020-2024 CERN.
5
+ #
6
+ # Invenio-Banners is free software; you can redistribute it and/or modify it
7
+ # under the terms of the MIT License; see LICENSE file for more details.
8
+
9
+ name: CI
10
+
11
+ on:
12
+ push:
13
+ branches: master
14
+ pull_request:
15
+ branches: master
16
+ schedule:
17
+ # * is a special character in YAML so you have to quote this string
18
+ - cron: "0 3 * * 6"
19
+ workflow_dispatch:
20
+ inputs:
21
+ reason:
22
+ description: "Reason"
23
+ required: false
24
+ default: "Manual trigger"
25
+
26
+ jobs:
27
+ Python:
28
+ uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master
@@ -1,6 +1,6 @@
1
1
  ..
2
2
  Copyright (C) 2020-2024 CERN.
3
- Copyright (C) 2024 Northwestern University.
3
+ Copyright (C) 2024 Graz University of Technology.
4
4
 
5
5
  Invenio-Banners is free software; you can redistribute it and/or modify
6
6
  it under the terms of the MIT License; see LICENSE file for more details.
@@ -8,10 +8,16 @@
8
8
  Changes
9
9
  =======
10
10
 
11
- Version v3.1.1 (released 2024-09-18)
11
+ Version v4.0.0 (released 2024-12-10)
12
12
 
13
- - admin: adjust + fix typos in descriptions of fields
14
- - i18n:push translations
13
+ - setup: change to reusable workflows
14
+ - setup: bump major dependencies
15
+
16
+ Version v3.2.0 (released 2024-11-05)
17
+
18
+ - feat(administration): use html editor for message
19
+ - global: change the code to be compatible with sqlalchemy >= 2.0
20
+ - global: add compatibility layer to move to flask >= 3.0
15
21
 
16
22
  Version v3.1.0 (released 2024-08-07)
17
23
 
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.1
2
+ Name: invenio-banners
3
+ Version: 4.0.0
4
+ Summary: Invenio-Banners is a module used to create and show banners with useful messages to users.
5
+ Home-page: https://github.com/inveniosoftware/invenio-banners
6
+ Author: CERN
7
+ Author-email: info@inveniosoftware.org
8
+ License: MIT
9
+ Keywords: Invenio Banners
10
+ Platform: any
11
+ Classifier: Development Status :: 1 - Planning
12
+ Requires-Python: >=3.7
13
+ License-File: LICENSE
14
+ License-File: AUTHORS.rst
15
+ Requires-Dist: invenio-i18n<4.0.0,>=3.0.0
16
+ Requires-Dist: invenio-administration<4.0.0,>=3.0.0
17
+ Provides-Extra: tests
18
+ Requires-Dist: pytest-black-ng>=0.4.0; extra == "tests"
19
+ Requires-Dist: pytest-invenio<4.0.0,>=3.0.0; extra == "tests"
20
+ Requires-Dist: jsonresolver>=0.3.2; extra == "tests"
21
+ Requires-Dist: invenio-app<3.0.0,>=2.0.0; extra == "tests"
22
+ Requires-Dist: sphinx>=4.5; extra == "tests"
23
+ Provides-Extra: opensearch1
24
+ Requires-Dist: invenio-search[opensearch1]<4.0.0,>=3.0.0; extra == "opensearch1"
25
+ Provides-Extra: opensearch2
26
+ Requires-Dist: invenio-search[opensearch2]<4.0.0,>=3.0.0; extra == "opensearch2"
27
+
28
+ ..
29
+ Copyright (C) 2020 CERN.
30
+
31
+ Invenio-Banners is free software; you can redistribute it and/or modify
32
+ it under the terms of the MIT License; see LICENSE file for more details.
33
+
34
+ =================
35
+ Invenio-Banners
36
+ =================
37
+
38
+ .. image:: https://img.shields.io/travis/inveniosoftware/invenio-banners.svg
39
+ :target: https://travis-ci.org/inveniosoftware/invenio-banners
40
+
41
+ .. image:: https://img.shields.io/coveralls/inveniosoftware/invenio-banners.svg
42
+ :target: https://coveralls.io/r/inveniosoftware/invenio-banners
43
+
44
+ .. image:: https://img.shields.io/github/tag/inveniosoftware/invenio-banners.svg
45
+ :target: https://github.com/inveniosoftware/invenio-banners/releases
46
+
47
+ .. image:: https://img.shields.io/pypi/dm/invenio-banners.svg
48
+ :target: https://pypi.python.org/pypi/invenio-banners
49
+
50
+ .. image:: https://img.shields.io/github/license/inveniosoftware/invenio-banners.svg
51
+ :target: https://github.com/inveniosoftware/invenio-banners/blob/master/LICENSE
52
+
53
+ Create and show banners with useful messages to users.
54
+
55
+ Further documentation is available on
56
+ https://invenio-banners.readthedocs.io/
57
+
58
+ ..
59
+ Copyright (C) 2020-2024 CERN.
60
+ Copyright (C) 2024 Graz University of Technology.
61
+
62
+ Invenio-Banners is free software; you can redistribute it and/or modify
63
+ it under the terms of the MIT License; see LICENSE file for more details.
64
+
65
+ Changes
66
+ =======
67
+
68
+ Version v4.0.0 (released 2024-12-10)
69
+
70
+ - setup: change to reusable workflows
71
+ - setup: bump major dependencies
72
+
73
+ Version v3.2.0 (released 2024-11-05)
74
+
75
+ - feat(administration): use html editor for message
76
+ - global: change the code to be compatible with sqlalchemy >= 2.0
77
+ - global: add compatibility layer to move to flask >= 3.0
78
+
79
+ Version v3.1.0 (released 2024-08-07)
80
+
81
+ - http headers: use and adjust vnd.inveniordm.v1+json http accept header
82
+
83
+ Version 3.0.2 (released 2024-07-17)
84
+
85
+ - errors: implement REST validation error for banner loader
86
+
87
+ Version 3.0.1 (released 2024-02-21)
88
+
89
+ - Moved admin menu item for banners to site administration category
90
+
91
+ Version 3.0.0 (released 2024-01-31)
92
+
93
+ - installation: bump invenio-administration
94
+
95
+ Version 2.1.1 (released 2023-07-24)
96
+
97
+ - ui: remove bottom margin
98
+
99
+ Version 2.1.0 (released 2023-03-02)
100
+
101
+ - remove deprecated flask-babelex imports
102
+ - install invenio-i18n explicitly
103
+
104
+ Version 2.0.0 (released 2023-02-15)
105
+
106
+ - global: refactor into resource/service pattern
107
+ - global: implement CRUD operations
108
+ - global: implement best practices for packaging (declarative cfg), code
109
+ linting (black) and testing
110
+ - search: improve banners search by query params
111
+ - administration: integrate banners view module
112
+
113
+
114
+ Version 1.0.0a1 (release 2020-10-25)
115
+ ------------------------------------
116
+
117
+ - Initial public release.
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2020-2024 CERN.
4
+ # Copyright (C) 2024 Graz University of Technology.
4
5
  #
5
6
  # Invenio-Banners is free software; you can redistribute it and/or modify it
6
7
  # under the terms of the MIT License; see LICENSE file for more details.
@@ -9,6 +10,6 @@
9
10
 
10
11
  from .ext import InvenioBanners
11
12
 
12
- __version__ = "3.1.1"
13
+ __version__ = "4.0.0"
13
14
 
14
15
  __all__ = ("__version__", "InvenioBanners")
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2020-2023 CERN.
4
+ # Copyright (C) 2024 Graz University of Technology.
4
5
  #
5
6
  # Invenio-Banners is free software; you can redistribute it and/or modify it
6
7
  # under the terms of the MIT License; see LICENSE file for more details.
@@ -13,7 +14,6 @@ import sqlalchemy as sa
13
14
  from flask import current_app
14
15
  from invenio_db import db
15
16
  from sqlalchemy import or_
16
- from sqlalchemy.orm.exc import NoResultFound
17
17
  from sqlalchemy.sql import text
18
18
  from sqlalchemy_utils.models import Timestamp
19
19
 
@@ -24,7 +24,6 @@ class BannerModel(db.Model, Timestamp):
24
24
  """Defines a message to show to users."""
25
25
 
26
26
  __tablename__ = "banners"
27
- __versioned__ = {"versioning": False}
28
27
 
29
28
  id = db.Column(db.Integer, primary_key=True)
30
29
 
@@ -51,6 +50,7 @@ class BannerModel(db.Model, Timestamp):
51
50
  """Create a new banner."""
52
51
  _categories = [t[0] for t in current_app.config["BANNERS_CATEGORIES"]]
53
52
  assert data.get("category") in _categories
53
+
54
54
  with db.session.begin_nested():
55
55
  obj = cls(
56
56
  message=data.get("message"),
@@ -62,24 +62,24 @@ class BannerModel(db.Model, Timestamp):
62
62
  )
63
63
  db.session.add(obj)
64
64
 
65
- db.session.commit()
66
65
  return obj
67
66
 
68
67
  @classmethod
69
68
  def update(cls, data, id):
70
69
  """Update an existing banner."""
71
70
  with db.session.begin_nested():
72
- cls.query.filter_by(id=id).update(data)
73
-
74
- db.session.commit()
71
+ # NOTE:
72
+ # with db.session.get(cls, id) the model itself would be
73
+ # returned and this classmethod would be called
74
+ db.session.query(cls).filter_by(id=id).update(data)
75
75
 
76
76
  @classmethod
77
77
  def get(cls, id):
78
78
  """Get banner by its id."""
79
- try:
80
- return cls.query.filter_by(id=id).one()
81
- except NoResultFound:
82
- raise BannerNotExistsError(id)
79
+ if banner := db.session.get(cls, id):
80
+ return banner
81
+
82
+ raise BannerNotExistsError(id)
83
83
 
84
84
  @classmethod
85
85
  def delete(cls, banner):
@@ -87,15 +87,14 @@ class BannerModel(db.Model, Timestamp):
87
87
  with db.session.begin_nested():
88
88
  db.session.delete(banner)
89
89
 
90
- db.session.commit()
91
-
92
90
  @classmethod
93
91
  def get_active(cls, url_path):
94
92
  """Return active banners."""
95
93
  now = datetime.utcnow()
96
94
 
97
95
  query = (
98
- cls.query.filter(cls.active.is_(True))
96
+ db.session.query(cls)
97
+ .filter(cls.active.is_(True))
99
98
  .filter(cls.start_datetime <= now)
100
99
  .filter((cls.end_datetime.is_(None)) | (now <= cls.end_datetime))
101
100
  )
@@ -113,16 +112,17 @@ class BannerModel(db.Model, Timestamp):
113
112
  @classmethod
114
113
  def search(cls, search_params, filters):
115
114
  """Filter banners accordingly to query params."""
116
- banners = (
117
- BannerModel.query.filter(or_(*filters))
118
- .order_by(
119
- search_params["sort_direction"](text(",".join(search_params["sort"])))
120
- )
121
- .paginate(
122
- page=search_params["page"],
123
- per_page=search_params["size"],
124
- error_out=False,
125
- )
115
+ if filters == []:
116
+ filtered = db.session.query(BannerModel).filter()
117
+ else:
118
+ filtered = db.session.query(BannerModel).filter(or_(*filters))
119
+
120
+ banners = filtered.order_by(
121
+ search_params["sort_direction"](text(",".join(search_params["sort"])))
122
+ ).paginate(
123
+ page=search_params["page"],
124
+ per_page=search_params["size"],
125
+ error_out=False,
126
126
  )
127
127
 
128
128
  return banners
@@ -133,12 +133,11 @@ class BannerModel(db.Model, Timestamp):
133
133
  now = datetime.utcnow()
134
134
 
135
135
  query = (
136
- cls.query.filter(cls.active.is_(True))
136
+ db.session.query(cls)
137
+ .filter(cls.active.is_(True))
137
138
  .filter(cls.end_datetime.isnot(None))
138
139
  .filter(cls.end_datetime < now)
139
140
  )
140
141
 
141
142
  for old in query.all():
142
143
  old.active = False
143
-
144
- db.session.commit()
@@ -1,19 +1,19 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2023 CERN.
4
+ # Copyright (C) 2024 Graz University of Technology.
4
5
  #
5
6
  # Invenio-Banners is free software; you can redistribute it and/or modify it
6
7
  # under the terms of the MIT License; see LICENSE file for more details.
7
8
 
8
9
  """Errors."""
9
10
 
10
- from flask_resources import HTTPJSONException, create_error_handler
11
-
12
- from ..services.errors import BannerNotExistsError
13
11
  import marshmallow as ma
14
12
  from flask_resources import HTTPJSONException, create_error_handler
15
13
  from invenio_records_resources.errors import validation_error_to_list_errors
16
14
 
15
+ from ..services.errors import BannerNotExistsError
16
+
17
17
 
18
18
  class HTTPJSONValidationException(HTTPJSONException):
19
19
  """HTTP exception serializing to JSON and reflecting Marshmallow errors."""
@@ -25,7 +25,7 @@ class HTTPJSONValidationException(HTTPJSONException):
25
25
  super().__init__(code=400, errors=validation_error_to_list_errors(exception))
26
26
 
27
27
 
28
- class ErrorHandlersMixin():
28
+ class ErrorHandlersMixin:
29
29
  """Mixin to define error handlers."""
30
30
 
31
31
  error_handlers = {
@@ -1,14 +1,22 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2022-2023 CERN.
4
+ # Copyright (C) 2024 Graz University of Technology.
4
5
  #
5
6
  # Invenio-Banners is free software; you can redistribute it and/or modify it
6
7
  # under the terms of the MIT License; see LICENSE file for more details.
7
8
 
8
9
  """Service results."""
9
- from flask_sqlalchemy import Pagination
10
+
10
11
  from invenio_records_resources.services.records.results import RecordItem, RecordList
11
12
 
13
+ try:
14
+ # flask_sqlalchemy<3.0.0
15
+ from flask_sqlalchemy import Pagination
16
+ except ImportError:
17
+ # flask_sqlalchemy>=3.0.0
18
+ from flask_sqlalchemy.pagination import Pagination
19
+
12
20
 
13
21
  class BannerItem(RecordItem):
14
22
  """Single banner result."""
@@ -11,13 +11,13 @@ from datetime import datetime, timezone
11
11
 
12
12
  from invenio_records_resources.services.records.schema import BaseRecordSchema
13
13
  from marshmallow import fields, pre_load
14
- from marshmallow_utils.fields import TZDateTime
14
+ from marshmallow_utils.fields import SanitizedHTML, TZDateTime
15
15
 
16
16
 
17
17
  class BannerSchema(BaseRecordSchema):
18
18
  """Schema for banners."""
19
19
 
20
- message = fields.String(required=True)
20
+ message = SanitizedHTML(required=True)
21
21
  url_path = fields.String(allow_none=True)
22
22
  category = fields.String(required=True, metadata={"default": "info"})
23
23
  start_datetime = fields.DateTime(
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2022-2023 CERN.
4
+ # Copyright (C) 2024 Graz University of Technology.
4
5
  #
5
6
  # Invenio-Banners is free software; you can redistribute it and/or modify it
6
7
  # under the terms of the MIT License; see LICENSE file for more details.
@@ -10,6 +11,7 @@
10
11
  import distutils.util
11
12
 
12
13
  import arrow
14
+ from invenio_db.uow import unit_of_work
13
15
  from invenio_records_resources.services import RecordService
14
16
  from invenio_records_resources.services.base import LinksTemplate
15
17
  from invenio_records_resources.services.base.utils import map_search_params
@@ -81,7 +83,8 @@ class BannerService(RecordService):
81
83
  links_item_tpl=self.links_item_tpl,
82
84
  )
83
85
 
84
- def create(self, identity, data, raise_errors=True):
86
+ @unit_of_work()
87
+ def create(self, identity, data, raise_errors=True, uow=None):
85
88
  """Create a banner."""
86
89
  self.require_permission(identity, "create")
87
90
 
@@ -99,17 +102,18 @@ class BannerService(RecordService):
99
102
  self, identity, banner, links_tpl=self.links_item_tpl, errors=errors
100
103
  )
101
104
 
102
- def delete(self, identity, id):
105
+ @unit_of_work()
106
+ def delete(self, identity, id, uow=None):
103
107
  """Delete a banner from database."""
104
108
  self.require_permission(identity, "delete")
105
109
 
106
110
  banner = self.record_cls.get(id)
107
-
108
111
  self.record_cls.delete(banner)
109
112
 
110
113
  return self.result_item(self, identity, banner, links_tpl=self.links_item_tpl)
111
114
 
112
- def update(self, identity, id, data):
115
+ @unit_of_work()
116
+ def update(self, identity, id, data, uow=None):
113
117
  """Update a banner."""
114
118
  self.require_permission(identity, "update")
115
119
 
@@ -131,7 +135,8 @@ class BannerService(RecordService):
131
135
  links_tpl=self.links_item_tpl,
132
136
  )
133
137
 
134
- def disable_expired(self, identity):
138
+ @unit_of_work()
139
+ def disable_expired(self, identity, uow=None):
135
140
  """Disable expired banners."""
136
141
  self.require_permission(identity, "disable")
137
142
  self.record_cls.disable_expired()
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.1
2
+ Name: invenio-banners
3
+ Version: 4.0.0
4
+ Summary: Invenio-Banners is a module used to create and show banners with useful messages to users.
5
+ Home-page: https://github.com/inveniosoftware/invenio-banners
6
+ Author: CERN
7
+ Author-email: info@inveniosoftware.org
8
+ License: MIT
9
+ Keywords: Invenio Banners
10
+ Platform: any
11
+ Classifier: Development Status :: 1 - Planning
12
+ Requires-Python: >=3.7
13
+ License-File: LICENSE
14
+ License-File: AUTHORS.rst
15
+ Requires-Dist: invenio-i18n<4.0.0,>=3.0.0
16
+ Requires-Dist: invenio-administration<4.0.0,>=3.0.0
17
+ Provides-Extra: tests
18
+ Requires-Dist: pytest-black-ng>=0.4.0; extra == "tests"
19
+ Requires-Dist: pytest-invenio<4.0.0,>=3.0.0; extra == "tests"
20
+ Requires-Dist: jsonresolver>=0.3.2; extra == "tests"
21
+ Requires-Dist: invenio-app<3.0.0,>=2.0.0; extra == "tests"
22
+ Requires-Dist: sphinx>=4.5; extra == "tests"
23
+ Provides-Extra: opensearch1
24
+ Requires-Dist: invenio-search[opensearch1]<4.0.0,>=3.0.0; extra == "opensearch1"
25
+ Provides-Extra: opensearch2
26
+ Requires-Dist: invenio-search[opensearch2]<4.0.0,>=3.0.0; extra == "opensearch2"
27
+
28
+ ..
29
+ Copyright (C) 2020 CERN.
30
+
31
+ Invenio-Banners is free software; you can redistribute it and/or modify
32
+ it under the terms of the MIT License; see LICENSE file for more details.
33
+
34
+ =================
35
+ Invenio-Banners
36
+ =================
37
+
38
+ .. image:: https://img.shields.io/travis/inveniosoftware/invenio-banners.svg
39
+ :target: https://travis-ci.org/inveniosoftware/invenio-banners
40
+
41
+ .. image:: https://img.shields.io/coveralls/inveniosoftware/invenio-banners.svg
42
+ :target: https://coveralls.io/r/inveniosoftware/invenio-banners
43
+
44
+ .. image:: https://img.shields.io/github/tag/inveniosoftware/invenio-banners.svg
45
+ :target: https://github.com/inveniosoftware/invenio-banners/releases
46
+
47
+ .. image:: https://img.shields.io/pypi/dm/invenio-banners.svg
48
+ :target: https://pypi.python.org/pypi/invenio-banners
49
+
50
+ .. image:: https://img.shields.io/github/license/inveniosoftware/invenio-banners.svg
51
+ :target: https://github.com/inveniosoftware/invenio-banners/blob/master/LICENSE
52
+
53
+ Create and show banners with useful messages to users.
54
+
55
+ Further documentation is available on
56
+ https://invenio-banners.readthedocs.io/
57
+
58
+ ..
59
+ Copyright (C) 2020-2024 CERN.
60
+ Copyright (C) 2024 Graz University of Technology.
61
+
62
+ Invenio-Banners is free software; you can redistribute it and/or modify
63
+ it under the terms of the MIT License; see LICENSE file for more details.
64
+
65
+ Changes
66
+ =======
67
+
68
+ Version v4.0.0 (released 2024-12-10)
69
+
70
+ - setup: change to reusable workflows
71
+ - setup: bump major dependencies
72
+
73
+ Version v3.2.0 (released 2024-11-05)
74
+
75
+ - feat(administration): use html editor for message
76
+ - global: change the code to be compatible with sqlalchemy >= 2.0
77
+ - global: add compatibility layer to move to flask >= 3.0
78
+
79
+ Version v3.1.0 (released 2024-08-07)
80
+
81
+ - http headers: use and adjust vnd.inveniordm.v1+json http accept header
82
+
83
+ Version 3.0.2 (released 2024-07-17)
84
+
85
+ - errors: implement REST validation error for banner loader
86
+
87
+ Version 3.0.1 (released 2024-02-21)
88
+
89
+ - Moved admin menu item for banners to site administration category
90
+
91
+ Version 3.0.0 (released 2024-01-31)
92
+
93
+ - installation: bump invenio-administration
94
+
95
+ Version 2.1.1 (released 2023-07-24)
96
+
97
+ - ui: remove bottom margin
98
+
99
+ Version 2.1.0 (released 2023-03-02)
100
+
101
+ - remove deprecated flask-babelex imports
102
+ - install invenio-i18n explicitly
103
+
104
+ Version 2.0.0 (released 2023-02-15)
105
+
106
+ - global: refactor into resource/service pattern
107
+ - global: implement CRUD operations
108
+ - global: implement best practices for packaging (declarative cfg), code
109
+ linting (black) and testing
110
+ - search: improve banners search by query params
111
+ - administration: integrate banners view module
112
+
113
+
114
+ Version 1.0.0a1 (release 2020-10-25)
115
+ ------------------------------------
116
+
117
+ - Initial public release.
@@ -18,4 +18,3 @@ invenio_banners = invenio_banners:alembic
18
18
 
19
19
  [invenio_db.models]
20
20
  invenio_banners = invenio_banners.records.models
21
-
@@ -0,0 +1,15 @@
1
+ invenio-i18n<4.0.0,>=3.0.0
2
+ invenio-administration<4.0.0,>=3.0.0
3
+
4
+ [opensearch1]
5
+ invenio-search[opensearch1]<4.0.0,>=3.0.0
6
+
7
+ [opensearch2]
8
+ invenio-search[opensearch2]<4.0.0,>=3.0.0
9
+
10
+ [tests]
11
+ pytest-black-ng>=0.4.0
12
+ pytest-invenio<4.0.0,>=3.0.0
13
+ jsonresolver>=0.3.2
14
+ invenio-app<3.0.0,>=2.0.0
15
+ sphinx>=4.5
@@ -18,19 +18,20 @@ packages = find:
18
18
  python_requires = >=3.7
19
19
  zip_safe = False
20
20
  install_requires =
21
- invenio-i18n>=2.0.0,<3.0.0
22
- invenio-administration>=2.0.0,<3.0.0
21
+ invenio-i18n>=3.0.0,<4.0.0
22
+ invenio-administration>=3.0.0,<4.0.0
23
23
 
24
24
  [options.extras_require]
25
25
  tests =
26
- pytest-invenio>=2.1.0,<3.0.0
27
- invenio-app>=1.3.4,<2.0.0
28
- pytest-black>=0.3.0
26
+ pytest-black-ng>=0.4.0
27
+ pytest-invenio>=3.0.0,<4.0.0
28
+ jsonresolver>=0.3.2
29
+ invenio-app>=2.0.0,<3.0.0
29
30
  sphinx>=4.5
30
31
  opensearch1 =
31
- invenio-search[opensearch1]>=2.1.0,<3.0.0
32
+ invenio-search[opensearch1]>=3.0.0,<4.0.0
32
33
  opensearch2 =
33
- invenio-search[opensearch2]>=2.1.0,<3.0.0
34
+ invenio-search[opensearch2]>=3.0.0,<4.0.0
34
35
 
35
36
  [options.entry_points]
36
37
  invenio_base.apps =