commonground-api-common 3.0.0__tar.gz → 3.1.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.
Files changed (263) hide show
  1. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/CHANGELOG.rst +78 -0
  2. {commonground_api_common-3.0.0/commonground_api_common.egg-info → commonground_api_common-3.1.0}/PKG-INFO +3 -2
  3. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/README.rst +1 -1
  4. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0/commonground_api_common.egg-info}/PKG-INFO +3 -2
  5. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/commonground_api_common.egg-info/SOURCES.txt +15 -0
  6. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/commonground_api_common.egg-info/requires.txt +1 -0
  7. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/pyproject.toml +5 -3
  8. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_cache_headers.py +29 -73
  9. commonground_api_common-3.1.0/tests/test_etag_algebra.py +247 -0
  10. commonground_api_common-3.1.0/tests/test_etag_batch.py +146 -0
  11. commonground_api_common-3.1.0/tests/test_etag_bulk.py +199 -0
  12. commonground_api_common-3.1.0/tests/test_etag_concurrency.py +865 -0
  13. commonground_api_common-3.1.0/tests/test_etag_cost.py +234 -0
  14. commonground_api_common-3.1.0/tests/test_etag_deadlocks.py +152 -0
  15. commonground_api_common-3.1.0/tests/test_etag_deploys.py +166 -0
  16. commonground_api_common-3.1.0/tests/test_etag_oracle.py +454 -0
  17. commonground_api_common-3.1.0/tests/test_etag_processes.py +59 -0
  18. commonground_api_common-3.1.0/tests/test_etag_registry.py +192 -0
  19. commonground_api_common-3.1.0/tests/test_etag_responses.py +264 -0
  20. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_exception_handler.py +27 -0
  21. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_nested_serializer_validation.py +53 -0
  22. commonground_api_common-3.1.0/vng_api_common/__init__.py +1 -0
  23. commonground_api_common-3.1.0/vng_api_common/caching/__init__.py +22 -0
  24. commonground_api_common-3.1.0/vng_api_common/caching/bulk.py +118 -0
  25. commonground_api_common-3.1.0/vng_api_common/caching/conditional.py +158 -0
  26. commonground_api_common-3.1.0/vng_api_common/caching/decorators.py +64 -0
  27. commonground_api_common-3.1.0/vng_api_common/caching/etags.py +103 -0
  28. commonground_api_common-3.1.0/vng_api_common/caching/models.py +69 -0
  29. commonground_api_common-3.1.0/vng_api_common/caching/registry.py +566 -0
  30. commonground_api_common-3.1.0/vng_api_common/caching/signals.py +287 -0
  31. commonground_api_common-3.1.0/vng_api_common/caching/store.py +320 -0
  32. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/conf/api.py +5 -0
  33. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/exception_handling.py +28 -1
  34. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/exceptions.py +15 -0
  35. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/locale/nl/LC_MESSAGES/django.mo +0 -0
  36. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/locale/nl/LC_MESSAGES/django.po +7 -1
  37. commonground_api_common-3.1.0/vng_api_common/migrations/0008_storedetag.py +27 -0
  38. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/models.py +4 -0
  39. commonground_api_common-3.0.0/vng_api_common/__init__.py +0 -1
  40. commonground_api_common-3.0.0/vng_api_common/caching/__init__.py +0 -21
  41. commonground_api_common-3.0.0/vng_api_common/caching/decorators.py +0 -42
  42. commonground_api_common-3.0.0/vng_api_common/caching/etags.py +0 -201
  43. commonground_api_common-3.0.0/vng_api_common/caching/models.py +0 -37
  44. commonground_api_common-3.0.0/vng_api_common/caching/registry.py +0 -184
  45. commonground_api_common-3.0.0/vng_api_common/caching/signals.py +0 -148
  46. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/MANIFEST.in +0 -0
  47. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/commonground_api_common.egg-info/dependency_links.txt +0 -0
  48. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/commonground_api_common.egg-info/not-zip-safe +0 -0
  49. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/commonground_api_common.egg-info/top_level.txt +0 -0
  50. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/setup.cfg +0 -0
  51. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_autorisatie_validation.py +0 -0
  52. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_cached_hyperlinkrelatedfields.py +0 -0
  53. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_check_query_params.py +0 -0
  54. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_checks.py +0 -0
  55. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_choices.py +0 -0
  56. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_configuration_steps_applicaties.py +0 -0
  57. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_configuration_steps_jwtsecrets.py +0 -0
  58. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_content_type_headers.py +0 -0
  59. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_exception_camelize.py +0 -0
  60. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_field_extensions.py +0 -0
  61. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_fields.py +0 -0
  62. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_filter_extension.py +0 -0
  63. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_filters.py +0 -0
  64. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_gegevensgroepen.py +0 -0
  65. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_get_resource.py +0 -0
  66. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_jwt_decoding.py +0 -0
  67. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_migrations.py +0 -0
  68. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_notes.py +0 -0
  69. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_pagination.py +0 -0
  70. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_permissions.py +0 -0
  71. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_publish_validators.py +0 -0
  72. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_schema.py +0 -0
  73. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_scopes.py +0 -0
  74. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_serializer_extensions.py +0 -0
  75. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_serializer_fields.py +0 -0
  76. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_server_errors.py +0 -0
  77. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_utils.py +0 -0
  78. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_validators.py +0 -0
  79. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/tests/test_views.py +0 -0
  80. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/admin.py +0 -0
  81. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/api/__init__.py +0 -0
  82. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/api/permissions.py +0 -0
  83. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/api/serializers.py +0 -0
  84. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/apps.py +0 -0
  85. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/__init__.py +0 -0
  86. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/admin.py +0 -0
  87. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/api/__init__.py +0 -0
  88. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/api/scopes.py +0 -0
  89. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/api/serializers.py +0 -0
  90. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/apps.py +0 -0
  91. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/audits.py +0 -0
  92. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0001_initial.py +0 -0
  93. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0002_auto_20190516_0830.py +0 -0
  94. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0003_auto_20190517_0844.py +0 -0
  95. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0004_auto_20190520_1238.py +0 -0
  96. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0005_auto_20190520_1450.py +0 -0
  97. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0006_audittrail_toelichting.py +0 -0
  98. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0007_auto_20190522_0916.py +0 -0
  99. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0008_audittrail_resource_weergave.py +0 -0
  100. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0009_auto_20190712_1643.py +0 -0
  101. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0010_audittrail_request_id.py +0 -0
  102. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0011_auto_20190918_1335.py +0 -0
  103. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0012_auto_20200619_0545.py +0 -0
  104. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0012_remove_audittrail_request_id.py +0 -0
  105. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0013_audittrail_logrecord_id.py +0 -0
  106. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0013_auto_20201207_0846.py +0 -0
  107. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0014_auto_20201221_0905.py +0 -0
  108. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0014_auto_20210323_1654.py +0 -0
  109. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0015_auto_20220318_1608.py +0 -0
  110. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0016_merge_20220607_0517.py +0 -0
  111. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0017_alter_audittrail_bron.py +0 -0
  112. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0018_auto_20221212_0745.py +0 -0
  113. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/0019_alter_audittrail_options.py +0 -0
  114. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/__init__.py +0 -0
  115. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/migrations/_operations.py +0 -0
  116. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/models.py +0 -0
  117. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/utils.py +0 -0
  118. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/audittrails/viewsets.py +0 -0
  119. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/__init__.py +0 -0
  120. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/admin.py +0 -0
  121. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/middleware.py +0 -0
  122. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0001_initial.py +0 -0
  123. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0002_authorizationsconfig.py +0 -0
  124. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0003_auto_20190502_0409.py +0 -0
  125. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0004_auto_20190503_0941.py +0 -0
  126. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0005_auto_20190506_0842.py +0 -0
  127. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0006_auto_20190506_0901.py +0 -0
  128. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0007_auto_20190506_1212.py +0 -0
  129. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0008_auto_20190712_1541.py +0 -0
  130. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0009_update_enums.py +0 -0
  131. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0010_auto_20190712_1643.py +0 -0
  132. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0011_auto_20191114_0728.py +0 -0
  133. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0012_auto_20200619_0545.py +0 -0
  134. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0013_auto_20201207_0846.py +0 -0
  135. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0014_auto_20201221_0905.py +0 -0
  136. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0015_auto_20220318_1608.py +0 -0
  137. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0016_remove_authorizationsconfig_api_root_and_more.py +0 -0
  138. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0017_alter_applicatie_client_ids_and_more.py +0 -0
  139. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/0018_alter_applicatie_options_alter_autorisatie_options.py +0 -0
  140. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/migrations/__init__.py +0 -0
  141. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/models.py +0 -0
  142. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/serializers.py +0 -0
  143. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/utils.py +0 -0
  144. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/authorizations/validators.py +0 -0
  145. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/caching/introspection.py +0 -0
  146. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/checks.py +0 -0
  147. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/choices.py +0 -0
  148. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/client.py +0 -0
  149. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/compat.py +0 -0
  150. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/conf/__init__.py +0 -0
  151. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/constants.py +0 -0
  152. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/contrib/__init__.py +0 -0
  153. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/contrib/setup_configuration/__init__.py +0 -0
  154. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/contrib/setup_configuration/models.py +0 -0
  155. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/contrib/setup_configuration/steps.py +0 -0
  156. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/db/__init__.py +0 -0
  157. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/db/operations.py +0 -0
  158. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/descriptors.py +0 -0
  159. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/diagrams/__init__.py +0 -0
  160. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/diagrams/generate_graphs.py +0 -0
  161. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/diagrams/uml_images.py +0 -0
  162. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/doc.py +0 -0
  163. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/__init__.py +0 -0
  164. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/file.py +0 -0
  165. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/gegevensgroep.py +0 -0
  166. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/geojson.py +0 -0
  167. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/hyperlink.py +0 -0
  168. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/polymorphic.py +0 -0
  169. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/extensions/query.py +0 -0
  170. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/fields.py +0 -0
  171. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/filters.py +0 -0
  172. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/filters_backend.py +0 -0
  173. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/filtersets.py +0 -0
  174. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/generators.py +0 -0
  175. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/geo.py +0 -0
  176. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/middleware.py +0 -0
  177. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0001_initial.py +0 -0
  178. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0002_apicredential.py +0 -0
  179. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0003_auto_20190417_1145.py +0 -0
  180. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0004_auto_20190517_0903.py +0 -0
  181. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0005_auto_20190614_1346.py +0 -0
  182. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0006_delete_apicredential.py +0 -0
  183. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/0007_alter_jwtsecret_options.py +0 -0
  184. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/migrations/__init__.py +0 -0
  185. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/mocks.py +0 -0
  186. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/__init__.py +0 -0
  187. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/api/__init__.py +0 -0
  188. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/api/serializers.py +0 -0
  189. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/api/viewsets.py +0 -0
  190. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/apps.py +0 -0
  191. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/constants.py +0 -0
  192. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notes/models.py +0 -0
  193. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/__init__.py +0 -0
  194. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/api/__init__.py +0 -0
  195. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/api/urls.py +0 -0
  196. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/api/views.py +0 -0
  197. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/apps.py +0 -0
  198. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/handlers.py +0 -0
  199. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0001_initial.py +0 -0
  200. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0002_subscription__subscription.py +0 -0
  201. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0003_auto_20190319_1048.py +0 -0
  202. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0004_auto_20190325_1313.py +0 -0
  203. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0005_fix_default_nrc.py +0 -0
  204. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0006_auto_20190417_1142.py +0 -0
  205. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0007_auto_20190429_1442.py +0 -0
  206. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0008_auto_20190502_0415.py +0 -0
  207. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0009_auto_20190729_0427.py +0 -0
  208. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0010_auto_20220704_1419.py +0 -0
  209. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/0011_remove_subscription_config_and_more.py +0 -0
  210. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/notifications/migrations/__init__.py +0 -0
  211. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/oas.py +0 -0
  212. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/pagination.py +0 -0
  213. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/permissions.py +0 -0
  214. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/polymorphism.py +0 -0
  215. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/routers.py +0 -0
  216. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/schema.py +0 -0
  217. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/scopes.py +0 -0
  218. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/search.py +0 -0
  219. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/serializers.py +0 -0
  220. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/settings.py +0 -0
  221. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/css/admin/admin_overrides.css +0 -0
  222. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/css/screen.css +0 -0
  223. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/ico/favicon.png +0 -0
  224. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/img/vng.svg +0 -0
  225. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/LICENSE.txt +0 -0
  226. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/css/all.css +0 -0
  227. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/css/all.min.css +0 -0
  228. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-brands-400.eot +0 -0
  229. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-brands-400.svg +0 -0
  230. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  231. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-brands-400.woff +0 -0
  232. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  233. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-regular-400.eot +0 -0
  234. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-regular-400.svg +0 -0
  235. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  236. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-regular-400.woff +0 -0
  237. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  238. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-solid-900.eot +0 -0
  239. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-solid-900.svg +0 -0
  240. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  241. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-solid-900.woff +0 -0
  242. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/static/vng_api_common/libs/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  243. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/admin/base_site.html +0 -0
  244. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/includes/kanalen_card.html +0 -0
  245. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/index.html +0 -0
  246. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/master.html +0 -0
  247. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/ref/error_detail.html +0 -0
  248. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/ref/scopes.html +0 -0
  249. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templates/vng_api_common/view_config.html +0 -0
  250. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templatetags/__init__.py +0 -0
  251. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/templatetags/vng_api_common.py +0 -0
  252. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/__init__.py +0 -0
  253. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/auth.py +0 -0
  254. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/caching.py +0 -0
  255. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/schema.py +0 -0
  256. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/urls.py +0 -0
  257. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/tests/utils.py +0 -0
  258. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/urls.py +0 -0
  259. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/utils.py +0 -0
  260. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/validators.py +0 -0
  261. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/version.py +0 -0
  262. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/views.py +0 -0
  263. {commonground_api_common-3.0.0 → commonground_api_common-3.1.0}/vng_api_common/viewsets.py +0 -0
@@ -2,6 +2,84 @@
2
2
  Change history
3
3
  ==============
4
4
 
5
+ 3.1.0 (2026-10-23)
6
+ ------------------
7
+
8
+ **Bugfixes**
9
+
10
+ * [open-zaak/open-zaak#2577] A write invalidates the ETags of every resource it
11
+ affects, before and after, in its own transaction, and a ``GET`` reads the ETag
12
+ and the body in one snapshot. This fixes 304s for changed resources after
13
+ deleting or moving a child, after a deploy, between a commit and the
14
+ recalculation, and for ``?expand=``.
15
+ * [open-zaak/open-zaak#2577] Writes serialize nothing, and their queries no longer
16
+ grow with the number of rows pointing at what they write. A save with
17
+ ``update_fields`` invalidates only the resources that show those columns. The
18
+ first ``GET`` after a write calculates the ETag. A 304 sends one indexed lookup
19
+ more, in a ``REPEATABLE READ`` transaction.
20
+
21
+ **New features**
22
+
23
+ * [open-zaak/open-zaak#2577] ``invalidating_update(queryset, **values)``: a
24
+ ``QuerySet.update`` that invalidates what it affects.
25
+ * [open-zaak/open-zaak#2577] ``batched_invalidation()``: a transaction in which
26
+ a loop of writes sends one query to invalidate ETags instead of one per write.
27
+ * [open-zaak/open-zaak#2577] ``invalidate_etags(*objs)`` after ``bulk_create``
28
+ and ``bulk_update``, and ``invalidate_all_etags(*resource_models)`` after raw
29
+ SQL: these send no signals, so their ETags have to be invalidated by hand.
30
+ * [open-zaak/open-zaak#2577] The exception handler answers a request whose
31
+ transaction PostgreSQL cancelled, to resolve a deadlock or a serialization
32
+ failure, with a 503 and ``Retry-After: 1`` instead of a 500. Nothing of it was
33
+ written, so the client can retry.
34
+ * [open-zaak/open-zaak#2577] This library's release is part of every ETag. Set
35
+ ``ETAG_REPRESENTATION_VERSION`` to your project's release to do the same for it.
36
+
37
+ **Deprecations**
38
+
39
+ * [open-zaak/open-zaak#2577] ``ETagMixin``: new models don't need it. Its ``_etag``
40
+ column is no longer maintained; drop it from your models.
41
+ * [open-zaak/open-zaak#2577] ``ETagMixin.calculate_etag_value``: use
42
+ ``invalidating_update`` instead of ``QuerySet.update``. It still invalidates
43
+ the resource's ETag.
44
+ * [open-zaak/open-zaak#2577] The ``etag_field`` of ``conditional_retrieve``,
45
+ which is ignored.
46
+ * [open-zaak/open-zaak#2577] The ``django-rest-framework-condition`` dependency,
47
+ which this library no longer uses.
48
+
49
+ **Upgrade notes**
50
+
51
+ * Migration ``0008`` creates the ``StoredETag`` table. The first ``GET`` of a
52
+ resource after the upgrade calculates its ETag.
53
+ * Write in a transaction, and don't serve conditional requests with
54
+ ``ATOMIC_REQUESTS``.
55
+ * A change or delete of a child that also saves its parent, such as one that
56
+ updates the parent's ``laatst_gemuteerd``, can deadlock with a save of that
57
+ parent. PostgreSQL detects the deadlock and cancels one of the two requests,
58
+ which gets a 503. Run such a write in ``batched_invalidation()``. Adding a child
59
+ needs no batch: its save locks the parent first.
60
+
61
+ **Maintenance**
62
+
63
+ * [open-zaak/open-zaak#2577] Removed implementation details: ``etag_func``,
64
+ ``EtagUpdate`` and ``MethodCallback`` from ``vng_api_common.caching.etags``,
65
+ ``add_dependency`` from ``vng_api_common.caching.registry``, and
66
+ ``handle_m2m_cleared``, ``is_etag_model`` and ``mark_affected_objects`` from
67
+ ``vng_api_common.caching.signals``. The receivers
68
+ ``mark_related_instances_for_etag_update`` and
69
+ ``mark_m2m_related_instances_for_etag_update`` stay, doing nothing, for
70
+ migrations that disconnect them.
71
+
72
+
73
+ 3.0.1 (2026-10-13)
74
+ ------------------
75
+
76
+ **Bugfixes**
77
+
78
+ * [#190] Support the DRF 3.18 dictionary-based list-serializer errors in the
79
+ exception handler. Errors for the first item of a list (index ``0``) lost their
80
+ index in ``invalidParams``. The list-based format is still supported.
81
+
82
+
5
83
  3.0.0 (2026-10-01)
6
84
  -------------------
7
85
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commonground-api-common
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Commonground API tooling
5
5
  Author-email: "Maykin Media, VNG-Realisatie" <support@maykinmedia.nl>
6
6
  License-Expression: MIT
@@ -63,6 +63,7 @@ Requires-Dist: freezegun; extra == "tests"
63
63
  Requires-Dist: zgw-consumers-oas; extra == "tests"
64
64
  Requires-Dist: djangorestframework-gis; extra == "tests"
65
65
  Requires-Dist: drf-extra-fields; extra == "tests"
66
+ Requires-Dist: hypothesis; extra == "tests"
66
67
  Provides-Extra: type-checking
67
68
  Requires-Dist: pyright; extra == "type-checking"
68
69
  Requires-Dist: django-stubs; extra == "type-checking"
@@ -88,7 +89,7 @@ Commonground-API-common - Tooling voor RESTful APIs
88
89
  ===================================================
89
90
 
90
91
 
91
- :Version: 3.0.0
92
+ :Version: 3.1.0
92
93
  :Source: https://github.com/maykinmedia/commonground-api-common
93
94
  :PythonVersion: 3.12
94
95
 
@@ -3,7 +3,7 @@ Commonground-API-common - Tooling voor RESTful APIs
3
3
  ===================================================
4
4
 
5
5
 
6
- :Version: 3.0.0
6
+ :Version: 3.1.0
7
7
  :Source: https://github.com/maykinmedia/commonground-api-common
8
8
  :PythonVersion: 3.12
9
9
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commonground-api-common
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Commonground API tooling
5
5
  Author-email: "Maykin Media, VNG-Realisatie" <support@maykinmedia.nl>
6
6
  License-Expression: MIT
@@ -63,6 +63,7 @@ Requires-Dist: freezegun; extra == "tests"
63
63
  Requires-Dist: zgw-consumers-oas; extra == "tests"
64
64
  Requires-Dist: djangorestframework-gis; extra == "tests"
65
65
  Requires-Dist: drf-extra-fields; extra == "tests"
66
+ Requires-Dist: hypothesis; extra == "tests"
66
67
  Provides-Extra: type-checking
67
68
  Requires-Dist: pyright; extra == "type-checking"
68
69
  Requires-Dist: django-stubs; extra == "type-checking"
@@ -88,7 +89,7 @@ Commonground-API-common - Tooling voor RESTful APIs
88
89
  ===================================================
89
90
 
90
91
 
91
- :Version: 3.0.0
92
+ :Version: 3.1.0
92
93
  :Source: https://github.com/maykinmedia/commonground-api-common
93
94
  :PythonVersion: 3.12
94
95
 
@@ -17,6 +17,17 @@ tests/test_choices.py
17
17
  tests/test_configuration_steps_applicaties.py
18
18
  tests/test_configuration_steps_jwtsecrets.py
19
19
  tests/test_content_type_headers.py
20
+ tests/test_etag_algebra.py
21
+ tests/test_etag_batch.py
22
+ tests/test_etag_bulk.py
23
+ tests/test_etag_concurrency.py
24
+ tests/test_etag_cost.py
25
+ tests/test_etag_deadlocks.py
26
+ tests/test_etag_deploys.py
27
+ tests/test_etag_oracle.py
28
+ tests/test_etag_processes.py
29
+ tests/test_etag_registry.py
30
+ tests/test_etag_responses.py
20
31
  tests/test_exception_camelize.py
21
32
  tests/test_exception_handler.py
22
33
  tests/test_field_extensions.py
@@ -141,12 +152,15 @@ vng_api_common/authorizations/migrations/0017_alter_applicatie_client_ids_and_mo
141
152
  vng_api_common/authorizations/migrations/0018_alter_applicatie_options_alter_autorisatie_options.py
142
153
  vng_api_common/authorizations/migrations/__init__.py
143
154
  vng_api_common/caching/__init__.py
155
+ vng_api_common/caching/bulk.py
156
+ vng_api_common/caching/conditional.py
144
157
  vng_api_common/caching/decorators.py
145
158
  vng_api_common/caching/etags.py
146
159
  vng_api_common/caching/introspection.py
147
160
  vng_api_common/caching/models.py
148
161
  vng_api_common/caching/registry.py
149
162
  vng_api_common/caching/signals.py
163
+ vng_api_common/caching/store.py
150
164
  vng_api_common/conf/__init__.py
151
165
  vng_api_common/conf/api.py
152
166
  vng_api_common/contrib/__init__.py
@@ -174,6 +188,7 @@ vng_api_common/migrations/0004_auto_20190517_0903.py
174
188
  vng_api_common/migrations/0005_auto_20190614_1346.py
175
189
  vng_api_common/migrations/0006_delete_apicredential.py
176
190
  vng_api_common/migrations/0007_alter_jwtsecret_options.py
191
+ vng_api_common/migrations/0008_storedetag.py
177
192
  vng_api_common/migrations/__init__.py
178
193
  vng_api_common/notes/__init__.py
179
194
  vng_api_common/notes/apps.py
@@ -61,6 +61,7 @@ freezegun
61
61
  zgw-consumers-oas
62
62
  djangorestframework-gis
63
63
  drf-extra-fields
64
+ hypothesis
64
65
 
65
66
  [testutils]
66
67
  zgw-consumers-oas
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "commonground-api-common"
7
- version = "3.0.0"
7
+ version = "3.1.0"
8
8
  description = "Commonground API tooling"
9
9
  readme = "README.rst"
10
10
  license = "MIT"
@@ -86,6 +86,7 @@ tests = [
86
86
  "zgw-consumers-oas",
87
87
  "djangorestframework-gis",
88
88
  "drf-extra-fields",
89
+ "hypothesis",
89
90
  ]
90
91
  type-checking = [
91
92
  "pyright",
@@ -133,6 +134,7 @@ include = ["vng_api_common*"]
133
134
  [tool.pytest.ini_options]
134
135
  testpaths = ["tests"]
135
136
  DJANGO_SETTINGS_MODULE = "testapp.settings"
137
+ pythonpath = "."
136
138
 
137
139
  [tool.coverage.run]
138
140
  branch = true
@@ -155,7 +157,7 @@ exclude_also = [
155
157
  ]
156
158
 
157
159
  [tool.bumpversion]
158
- current_version = "3.0.0"
160
+ current_version = "3.1.0"
159
161
  files = [
160
162
  {filename = "pyproject.toml"},
161
163
  {filename = "README.rst"},
@@ -270,4 +272,4 @@ msg = "Use `structlog.stdlib.get_logger(__name__)` instead."
270
272
  line-ending = "lf"
271
273
 
272
274
  [tool.setuptools.package-data]
273
- open_api_framework = ["py.typed"]
275
+ open_api_framework = ["py.typed"]
@@ -1,6 +1,5 @@
1
1
  from unittest.mock import patch
2
2
 
3
- from django.db import transaction
4
3
  from django.urls import path
5
4
 
6
5
  import pytest
@@ -13,7 +12,7 @@ from testapp.serializers import HobbySerializer
13
12
  from testapp.viewsets import PersonViewSet
14
13
  from tests import generate_schema
15
14
  from vng_api_common.caching.decorators import conditional_retrieve
16
- from vng_api_common.caching.etags import EtagUpdate
15
+ from vng_api_common.caching.etags import calculate_etag
17
16
 
18
17
  pytestmark = pytest.mark.django_db(transaction=True)
19
18
 
@@ -24,14 +23,14 @@ def test_etag_header_present(api_client, person):
24
23
 
25
24
  response = api_client.get(path)
26
25
 
27
- person.refresh_from_db()
28
26
  assert response.status_code == status.HTTP_200_OK
29
27
  assert "ETag" in response
30
- assert response["ETag"] == f'"{person._etag}"'
28
+ assert response["ETag"] == f'"{calculate_etag(person)}"'
31
29
 
32
30
 
33
31
  def test_304_on_cached_resource(api_client, person):
34
- person.calculate_etag_value()
32
+ with pytest.deprecated_call():
33
+ person.calculate_etag_value()
35
34
  path = reverse("person-detail", kwargs={"pk": person.pk})
36
35
 
37
36
  response = api_client.get(path, HTTP_IF_NONE_MATCH=f'"{person._etag}"')
@@ -65,9 +64,8 @@ def test_cache_headers_detected():
65
64
  assert headers[0]["name"] == "If-None-Match"
66
65
 
67
66
 
68
- @pytest.mark.django_db(transaction=False)
69
- def test_related_resource_changes_recalculate_etag1(django_capture_on_commit_callbacks):
70
- # Assert that resources references in the serializer trigger ETag recalculates, while
67
+ def test_related_resource_changes_recalculate_etag1(api_client):
68
+ # Assert that resources referenced in the serializer change the ETag, while
71
69
  # resources not referenced don't.
72
70
  hobbies = [
73
71
  HobbyFactory.create(name="playing guitar"),
@@ -83,55 +81,32 @@ def test_related_resource_changes_recalculate_etag1(django_capture_on_commit_cal
83
81
  group=GroupFactory.create(name="Brut"),
84
82
  )
85
83
  person.hobbies.set(hobbies) # not included in serializer
86
- person.calculate_etag_value()
87
-
88
- # discard any scheduled callback handlers from test set up
89
- transaction.get_connection().run_on_commit = []
90
-
91
- assert person._etag, "No ETag value calculated"
92
- initial_etag_value = person._etag
93
-
94
- # start test 1 - changing the hobbies should not result in changed etags
95
- with django_capture_on_commit_callbacks(execute=True):
96
- person.hobbies.clear()
84
+ path = reverse("person-detail", kwargs={"pk": person.pk})
85
+ initial_etag = api_client.get(path)["ETag"]
97
86
 
98
- person.refresh_from_db()
87
+ # changing the hobbies does not change the representation, nor the ETag
88
+ person.hobbies.clear()
99
89
 
100
- assert person._etag == initial_etag_value
90
+ assert api_client.get(path)["ETag"] == initial_etag
101
91
 
102
- # start test 2 - changing the group does affect the serializer output and thus the etag value
103
- # discard any scheduled callback handlers from test set up
104
- transaction.get_connection().run_on_commit = []
105
- with django_capture_on_commit_callbacks(execute=True):
106
- person.group.name = "DWTD"
107
- person.group.save()
92
+ # changing the group does change the representation, and the ETag
93
+ person.group.name = "DWTD"
94
+ person.group.save()
108
95
 
109
- person.refresh_from_db()
96
+ assert api_client.get(path)["ETag"] != initial_etag
110
97
 
111
- assert person._etag, "ETag should have been set"
112
- assert person._etag != initial_etag_value, "ETag value should have been changed"
113
98
 
114
-
115
- @pytest.mark.django_db(transaction=False)
116
- def test_related_resource_changes_recalculate_etag2(django_capture_on_commit_callbacks):
99
+ def test_related_resource_changes_recalculate_etag2(api_client):
117
100
  # has a simple (reverse) m2m to Person
118
101
  person = PersonFactory.create()
119
102
  hobby = HobbyFactory.create()
120
- hobby.calculate_etag_value()
121
-
122
- assert hobby._etag, "No ETag value calculated"
123
- initial_etag_value = hobby._etag
103
+ path = reverse("hobby-detail", kwargs={"pk": hobby.pk})
104
+ initial_etag = api_client.get(path)["ETag"]
124
105
 
125
- # now, change the related people resource to the hobby, which should trigger a
126
- # re-calculate
127
- # discard any scheduled callback handlers from test set up
128
- transaction.get_connection().run_on_commit = []
129
- with django_capture_on_commit_callbacks(execute=True):
130
- person.hobbies.add(hobby)
106
+ # now, change the related people resource to the hobby
107
+ person.hobbies.add(hobby)
131
108
 
132
- hobby.refresh_from_db()
133
- assert hobby._etag, "ETag should have been set"
134
- assert hobby._etag != initial_etag_value, "ETag value should have been changed"
109
+ assert api_client.get(path)["ETag"] != initial_etag
135
110
 
136
111
 
137
112
  def test_etag_changes_m2m_changes_forward(api_client, hobby, person):
@@ -256,20 +231,6 @@ def test_fetching_cache_enabled_deleted_resource_404s(api_client, person):
256
231
  assert response.status_code == 404
257
232
 
258
233
 
259
- @pytest.mark.django_db(transaction=False)
260
- def test_etag_updates_deduped(django_capture_on_commit_callbacks):
261
- with patch(
262
- "testapp.models.Person.calculate_etag_value"
263
- ) as mock_calculate_etag_value:
264
- with django_capture_on_commit_callbacks(execute=True):
265
- # one post_save
266
- person = PersonFactory.create()
267
- # second post_save
268
- person.save()
269
-
270
- assert mock_calculate_etag_value.call_count == 1
271
-
272
-
273
234
  class DynamicSerializerViewSet(viewsets.ReadOnlyModelViewSet):
274
235
  queryset = Hobby.objects.all()
275
236
 
@@ -287,21 +248,16 @@ def test_dynamic_serializer():
287
248
  assert Person in REPLACEMENT_REGISTRY
288
249
 
289
250
 
251
+ def test_etag_field_is_deprecated():
252
+ with (
253
+ pytest.deprecated_call(),
254
+ patch("vng_api_common.caching.registry.DEPENDENCY_REGISTRY", new={}),
255
+ ):
256
+ conditional_retrieve(etag_field="_etag")(DynamicSerializerViewSet)
257
+
258
+
290
259
  def test_etag_object_cascading_delete():
291
260
  group = GroupFactory.create()
292
261
  PersonFactory.create(group=group)
293
262
 
294
263
  group.delete()
295
-
296
-
297
- def test_calculate_new_value_skips_instance_without_pk():
298
- person = PersonFactory.create()
299
- etag_update = EtagUpdate(instance=person)
300
-
301
- person.delete()
302
- assert person.pk is None
303
-
304
- with patch.object(person, "calculate_etag_value") as calculate_etag_value:
305
- etag_update.calculate_new_value()
306
-
307
- calculate_etag_value.assert_not_called()
@@ -0,0 +1,247 @@
1
+ """
2
+ Laws of the primitives that decide what a write invalidates.
3
+
4
+ :class:`Dependency` values form a small algebra: ``merge`` joins what two
5
+ dependencies of one lookup read, and ``reads`` and ``moves`` say whether a save
6
+ writing some columns concerns them. The fast paths are checked against the
7
+ definitions, on testapp's registry and data drawn by hypothesis: reading a
8
+ parent off the instance, finding resources for many rows at once, narrowing a
9
+ save to its ``update_fields``, and updating in bulk.
10
+ """
11
+
12
+ from collections.abc import Iterator
13
+ from functools import reduce
14
+ from unittest.mock import patch
15
+
16
+ from django.db.models import Model
17
+
18
+ import pytest
19
+ from hypothesis import HealthCheck, given, settings, strategies as st
20
+
21
+ from testapp.models import Attachment, Folder, Sheet, Shortcut, Tag
22
+ from vng_api_common.caching import invalidating_update
23
+ from vng_api_common.caching.registry import (
24
+ ALL,
25
+ DEPENDENCY_REGISTRY,
26
+ Columns,
27
+ Dependency,
28
+ affected,
29
+ affected_by_save,
30
+ before_save,
31
+ overlap,
32
+ )
33
+ from vng_api_common.caching.store import Resource
34
+
35
+ from .etags import reset_database
36
+
37
+ COLUMNS = ("a", "b", "c")
38
+ columns: st.SearchStrategy[Columns] = st.just(ALL) | st.frozensets(
39
+ st.sampled_from(COLUMNS)
40
+ )
41
+ # one lookup, so any two merge; its parent follows from the lookup
42
+ dependencies = st.builds(
43
+ Dependency,
44
+ resource=st.just(Folder),
45
+ lookup=st.just("sheets"),
46
+ membership=columns,
47
+ shown=columns,
48
+ parent=st.just(None),
49
+ enforced=st.booleans(),
50
+ )
51
+
52
+
53
+ @given(columns, columns)
54
+ def test_a_union_of_columns_commutes(a: Columns, b: Columns):
55
+ assert a | b == b | a
56
+
57
+
58
+ @given(columns, columns, columns)
59
+ def test_a_union_of_columns_associates(a: Columns, b: Columns, c: Columns):
60
+ assert (a | b) | c == a | (b | c)
61
+
62
+
63
+ @given(columns)
64
+ def test_all_columns_bound_every_union(a: Columns):
65
+ assert a | a == a
66
+ assert a | frozenset() == a
67
+ assert a | ALL == ALL
68
+ assert all(name in ALL for name in COLUMNS)
69
+
70
+
71
+ @given(columns, columns, columns)
72
+ def test_overlap_is_symmetric_and_distributes_over_union(
73
+ a: Columns, b: Columns, c: Columns
74
+ ):
75
+ assert overlap(a, b) == overlap(b, a)
76
+ assert overlap(a, b | c) == (overlap(a, b) or overlap(a, c))
77
+ assert overlap(a, ALL) == (a != frozenset())
78
+
79
+
80
+ @given(dependencies, dependencies)
81
+ def test_merge_commutes(a: Dependency, b: Dependency):
82
+ assert a.merge(b) == b.merge(a)
83
+
84
+
85
+ @given(dependencies, dependencies, dependencies)
86
+ def test_merge_associates(a: Dependency, b: Dependency, c: Dependency):
87
+ assert a.merge(b).merge(c) == a.merge(b.merge(c))
88
+
89
+
90
+ @given(dependencies)
91
+ def test_merge_is_idempotent(a: Dependency):
92
+ assert a.merge(a) == a
93
+
94
+
95
+ @given(dependencies, dependencies, columns)
96
+ def test_a_merge_concerns_a_save_when_either_part_does(
97
+ a: Dependency, b: Dependency, written: Columns
98
+ ):
99
+ merged = a.merge(b)
100
+ assert merged.reads(written) == (a.reads(written) or b.reads(written))
101
+ assert merged.moves(written) == (a.moves(written) or b.moves(written))
102
+
103
+
104
+ @given(dependencies, columns, columns)
105
+ def test_writing_more_concerns_more(a: Dependency, written: Columns, more: Columns):
106
+ assert a.reads(written) <= a.reads(written | more)
107
+ assert a.moves(written) <= a.moves(written | more)
108
+ assert a.reads(written) <= a.reads(ALL)
109
+
110
+
111
+ @given(dependencies, columns)
112
+ def test_a_save_that_may_move_a_row_may_change_what_reads_it(
113
+ a: Dependency, written: Columns
114
+ ):
115
+ assert a.moves(written) <= a.reads(written)
116
+
117
+
118
+ # testapp's registry, on data drawn by hypothesis
119
+
120
+ LABELS = st.sampled_from("ab")
121
+ data_settings = settings(
122
+ max_examples=50,
123
+ deadline=None,
124
+ suppress_health_check=[HealthCheck.function_scoped_fixture, HealthCheck.too_slow],
125
+ )
126
+
127
+
128
+ @st.composite
129
+ def written_data(draw: st.DrawFn) -> None:
130
+ """Folders, and sheets, tags, attachments and shortcuts between them."""
131
+ reset_database()
132
+ folders = [
133
+ Folder.objects.create(name=draw(LABELS), code=draw(LABELS))
134
+ for _ in range(draw(st.integers(1, 3)))
135
+ ]
136
+ some_folder = st.sampled_from(folders)
137
+ for position in range(draw(st.integers(0, 3))):
138
+ Sheet.objects.create(
139
+ folder=draw(some_folder), title=draw(LABELS), position=position
140
+ )
141
+ for _ in range(draw(st.integers(0, 2))):
142
+ tag = Tag.objects.create(label=draw(LABELS))
143
+ tag.folders.set(draw(st.lists(some_folder, unique_by=lambda f: f.pk)))
144
+ for _ in range(draw(st.integers(0, 2))):
145
+ Attachment.objects.create(folder=draw(some_folder), filename=draw(LABELS))
146
+ for _ in range(draw(st.integers(0, 2))):
147
+ Shortcut.objects.create(
148
+ label=draw(LABELS), target=draw(st.none() | some_folder)
149
+ )
150
+
151
+
152
+ def registered_rows() -> Iterator[tuple[Dependency, Model]]:
153
+ """Each registered dependency, with each row of its source, fresh."""
154
+ for source, registered in DEPENDENCY_REGISTRY.items():
155
+ for dependency in registered:
156
+ for row in source._base_manager.all():
157
+ yield dependency, row
158
+
159
+
160
+ def fields_of(model: type[Model]) -> st.SearchStrategy[frozenset[str]]:
161
+ names = [f.name for f in model._meta.concrete_fields if not f.primary_key]
162
+ return st.frozensets(st.sampled_from(names))
163
+
164
+
165
+ pytestmark = pytest.mark.usefixtures("etag_api")
166
+
167
+
168
+ @pytest.mark.django_db(transaction=True)
169
+ @data_settings
170
+ @given(written_data())
171
+ def test_reading_the_parent_off_a_fresh_row_finds_what_the_lookup_does(_: None):
172
+ for dependency, row in registered_rows():
173
+ assert dependency.parent_of(row, ALL) == dependency.resources(row)
174
+
175
+
176
+ @pytest.mark.django_db(transaction=True)
177
+ @data_settings
178
+ @given(written_data())
179
+ def test_resources_of_many_rows_are_those_of_each(_: None):
180
+ for source, registered in DEPENDENCY_REGISTRY.items():
181
+ rows = list(source._base_manager.all())
182
+ for dependency in registered:
183
+ each = frozenset[Resource]().union(*map(dependency.resources, rows))
184
+ assert dependency.resources_of([row.pk for row in rows]) == each
185
+
186
+
187
+ @pytest.mark.django_db(transaction=True)
188
+ @data_settings
189
+ @given(written_data(), st.data())
190
+ def test_a_save_of_some_columns_affects_no_more_than_one_of_all_or_a_delete(
191
+ _: None, data: st.DataObject
192
+ ):
193
+ for model in (Folder, Sheet, Tag, Attachment, Shortcut):
194
+ for row in model._base_manager.all():
195
+ written = data.draw(fields_of(model), label=f"{model.__name__} fields")
196
+ # a save can't change a primary key, which some resources show alone
197
+ everything = affected_by_save(row, ALL, created=False)
198
+ assert affected_by_save(row, written, created=False) <= everything
199
+ assert everything <= affected(row)
200
+ registered = DEPENDENCY_REGISTRY.get(model, ())
201
+ assert {d for d in registered if d.moves(written)} <= set(
202
+ before_save(model, written)
203
+ )
204
+
205
+
206
+ @pytest.mark.django_db(transaction=True)
207
+ @data_settings
208
+ @given(written_data(), st.data())
209
+ def test_an_update_in_bulk_invalidates_what_saving_each_row_would(
210
+ _: None, data: st.DataObject
211
+ ):
212
+ """
213
+ Saving each row with ``update_fields`` invalidates, before the save, the
214
+ resources the row may leave, and after it, those its new columns concern.
215
+ """
216
+ if not Sheet.objects.exists():
217
+ return
218
+ field = data.draw(st.sampled_from(["folder", "title", "position"]), label="field")
219
+ value = {
220
+ "folder": lambda: data.draw(st.sampled_from(list(Folder.objects.all()))),
221
+ "title": lambda: data.draw(LABELS),
222
+ "position": lambda: data.draw(st.integers(0, 3)),
223
+ }[field]()
224
+ rows = Sheet.objects.filter(title=data.draw(LABELS, label="title selected"))
225
+ written = frozenset({field})
226
+ before = reduce(
227
+ frozenset.union,
228
+ (d.resources(row) for row in rows for d in before_save(Sheet, written)),
229
+ frozenset(),
230
+ )
231
+
232
+ invalidated: set[Resource] = set()
233
+ with patch(
234
+ "vng_api_common.caching.bulk.invalidate", side_effect=invalidated.update
235
+ ):
236
+ pks = list(rows.values_list("pk", flat=True))
237
+ invalidating_update(rows, **{field: value})
238
+
239
+ after = reduce(
240
+ frozenset.union,
241
+ (
242
+ affected_by_save(row, written, created=False)
243
+ for row in Sheet.objects.filter(pk__in=pks)
244
+ ),
245
+ frozenset(),
246
+ )
247
+ assert before | after <= invalidated