django-bulk-hooks 0.1.243__tar.gz → 0.1.244__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 django-bulk-hooks might be problematic. Click here for more details.

Files changed (17) hide show
  1. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/PKG-INFO +1 -1
  2. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/queryset.py +9 -14
  3. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/pyproject.toml +1 -1
  4. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/LICENSE +0 -0
  5. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/README.md +0 -0
  6. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/__init__.py +0 -0
  7. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/conditions.py +0 -0
  8. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/constants.py +0 -0
  9. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/context.py +0 -0
  10. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/decorators.py +0 -0
  11. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/engine.py +0 -0
  12. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/enums.py +0 -0
  13. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/handler.py +0 -0
  14. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/manager.py +0 -0
  15. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/models.py +0 -0
  16. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/priority.py +0 -0
  17. {django_bulk_hooks-0.1.243 → django_bulk_hooks-0.1.244}/django_bulk_hooks/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.243
3
+ Version: 0.1.244
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  Home-page: https://github.com/AugendLimited/django-bulk-hooks
6
6
  License: MIT
@@ -158,18 +158,20 @@ class HookQuerySetMixin:
158
158
  else:
159
159
  setattr(obj, field, value)
160
160
 
161
- # Check if we're in a bulk operation context to prevent double hook execution
161
+ # Salesforce-style trigger behavior: Always run hooks, rely on Django's stack overflow protection
162
162
  from django_bulk_hooks.context import get_bypass_hooks
163
163
 
164
164
  current_bypass_hooks = get_bypass_hooks()
165
165
 
166
- # If we're in a bulk operation context, skip hooks to prevent double execution
166
+ # Only skip hooks if explicitly bypassed (not for recursion prevention)
167
167
  if current_bypass_hooks:
168
- logger.debug("update: skipping hooks (bulk context)")
168
+ logger.debug("update: hooks explicitly bypassed")
169
169
  ctx = HookContext(model_cls, bypass_hooks=True)
170
170
  else:
171
- logger.debug("update: running hooks (standalone)")
171
+ # Always run hooks - Django will handle stack overflow protection
172
+ logger.debug("update: running hooks with Salesforce-style behavior")
172
173
  ctx = HookContext(model_cls, bypass_hooks=False)
174
+
173
175
  # Run validation hooks first
174
176
  engine.run(model_cls, VALIDATE_UPDATE, instances, originals, ctx=ctx)
175
177
  # Then run BEFORE_UPDATE hooks
@@ -395,19 +397,12 @@ class HookQuerySetMixin:
395
397
  getattr(refreshed_instance, field.name),
396
398
  )
397
399
 
398
- # Run AFTER_UPDATE hooks for standalone updates or subquery operations
399
- # For subquery operations, we need to run hooks even if we're in a bulk context
400
- # because subqueries bypass the normal object-level update flow
401
- should_run_hooks = (
402
- not current_bypass_hooks
403
- or has_subquery # Always run hooks for subquery operations
404
- )
405
-
406
- if should_run_hooks:
400
+ # Salesforce-style: Always run AFTER_UPDATE hooks unless explicitly bypassed
401
+ if not current_bypass_hooks:
407
402
  logger.debug("update: running AFTER_UPDATE")
408
403
  engine.run(model_cls, AFTER_UPDATE, instances, originals, ctx=ctx)
409
404
  else:
410
- logger.debug("update: skipping AFTER_UPDATE (bulk context)")
405
+ logger.debug("update: AFTER_UPDATE explicitly bypassed")
411
406
 
412
407
  return update_count
413
408
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-bulk-hooks"
3
- version = "0.1.243"
3
+ version = "0.1.244"
4
4
  description = "Hook-style hooks for Django bulk operations like bulk_create and bulk_update."
5
5
  authors = ["Konrad Beck <konrad.beck@merchantcapital.co.za>"]
6
6
  readme = "README.md"