django-bulk-hooks 0.1.220__py3-none-any.whl → 0.1.221__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of django-bulk-hooks might be problematic. Click here for more details.

@@ -71,19 +71,16 @@ class HasChanged(HookCondition):
71
71
  self.has_changed = has_changed
72
72
 
73
73
  def check(self, instance, original_instance=None):
74
- logger.debug(f"HasChanged.check called for field '{self.field}' on instance {getattr(instance, 'pk', 'No PK')}")
75
- logger.debug(f"Original instance: {getattr(original_instance, 'pk', 'No PK') if original_instance else 'None'}")
76
-
77
74
  if not original_instance:
78
- logger.debug("No original instance, returning False")
79
75
  return False
80
76
 
81
77
  current = resolve_dotted_attr(instance, self.field)
82
78
  previous = resolve_dotted_attr(original_instance, self.field)
83
79
 
84
- # Add more detailed debugging
85
80
  result = (current != previous) == self.has_changed
86
- logger.debug(f"HasChanged {self.field} result={result}")
81
+ # Only log when there's an actual change to reduce noise
82
+ if result:
83
+ logger.debug(f"HasChanged {self.field} detected change on instance {getattr(instance, 'pk', 'No PK')}")
87
84
  return result
88
85
 
89
86
 
@@ -81,10 +81,10 @@ class HookQuerySetMixin:
81
81
 
82
82
  # If we're in a bulk operation context, skip hooks to prevent double execution
83
83
  if current_bypass_hooks:
84
- logger.debug("update skipping hooks (bulk context)")
84
+ logger.debug("update: skipping hooks (bulk context)")
85
85
  ctx = HookContext(model_cls, bypass_hooks=True)
86
86
  else:
87
- logger.debug("update running hooks (standalone)")
87
+ logger.debug("update: running hooks (standalone)")
88
88
  ctx = HookContext(model_cls, bypass_hooks=False)
89
89
  # Run validation hooks first
90
90
  engine.run(model_cls, VALIDATE_UPDATE, instances, originals, ctx=ctx)
@@ -118,10 +118,10 @@ class HookQuerySetMixin:
118
118
 
119
119
  # Run AFTER_UPDATE hooks only for standalone updates
120
120
  if not current_bypass_hooks:
121
- logger.debug("update running AFTER_UPDATE")
121
+ logger.debug("update: running AFTER_UPDATE")
122
122
  engine.run(model_cls, AFTER_UPDATE, instances, originals, ctx=ctx)
123
123
  else:
124
- logger.debug("update skipping AFTER_UPDATE (bulk context)")
124
+ logger.debug("update: skipping AFTER_UPDATE (bulk context)")
125
125
 
126
126
  return update_count
127
127
 
@@ -251,11 +251,11 @@ class HookQuerySetMixin:
251
251
  break
252
252
 
253
253
  if not bypass_hooks:
254
- logger.debug("bulk_update setting bypass_hooks=False (hooks will run in update())")
254
+ logger.debug("bulk_update: hooks will run in update()")
255
255
  ctx = HookContext(model_cls, bypass_hooks=False)
256
256
  originals = [None] * len(objs) # Placeholder for after_update call
257
257
  else:
258
- logger.debug("bulk_update setting bypass_hooks=True (no hooks)")
258
+ logger.debug("bulk_update: hooks bypassed")
259
259
  ctx = HookContext(model_cls, bypass_hooks=True)
260
260
  originals = [None] * len(objs) # Ensure originals is defined for after_update call
261
261
 
@@ -289,9 +289,9 @@ class HookQuerySetMixin:
289
289
  # Note: We don't run AFTER_UPDATE hooks here to prevent double execution
290
290
  # The update() method will handle all hook execution based on thread-local state
291
291
  if not bypass_hooks:
292
- logger.debug("bulk_update skipping AFTER_UPDATE (update() will handle)")
292
+ logger.debug("bulk_update: skipping AFTER_UPDATE (update() will handle)")
293
293
  else:
294
- logger.debug("bulk_update bypassed hooks")
294
+ logger.debug("bulk_update: hooks bypassed")
295
295
 
296
296
  return result
297
297
 
@@ -23,7 +23,9 @@ def register_hook(
23
23
  def get_hooks(model, event):
24
24
  key = (model, event)
25
25
  hooks = _hooks.get(key, [])
26
- logger.debug(f"get_hooks {model.__name__}.{event} found {len(hooks)} hooks")
26
+ # Only log when hooks are found or for specific events to reduce noise
27
+ if hooks or event in ['after_update', 'before_update', 'after_create', 'before_create']:
28
+ logger.debug(f"get_hooks {model.__name__}.{event} found {len(hooks)} hooks")
27
29
  return hooks
28
30
 
29
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.220
3
+ Version: 0.1.221
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -1,5 +1,5 @@
1
1
  django_bulk_hooks/__init__.py,sha256=uUgpnb9AWjIAcWNpCMqBcOewSnpJjJYH6cjPbQkzoNU,140
2
- django_bulk_hooks/conditions.py,sha256=hI-LfcRZBiBrmfAVJZfjEnw7F2XJ0xvkd4J3NGzMpGc,6572
2
+ django_bulk_hooks/conditions.py,sha256=V_f3Di2uCVUjoyfiU4BQCHmI4uUIRSRroApDcXlvnso,6349
3
3
  django_bulk_hooks/constants.py,sha256=3x1H1fSUUNo0DZONN7GUVDuySZctTR-jtByBHmAIX5w,303
4
4
  django_bulk_hooks/context.py,sha256=_NbGWTq9s66g0vbFIaqN4GlIHWQmFg3EQ44qY8YvvEg,1537
5
5
  django_bulk_hooks/decorators.py,sha256=WD7Jn7QAvY8F4wOsYlIpjoM9-FdHXSKB7hH9ot-lkYQ,4896
@@ -9,9 +9,9 @@ django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,
9
9
  django_bulk_hooks/manager.py,sha256=nfWiwU5-yAoxdnQsUMohxtyCpkV0MBv6X3wmipr9eQY,3697
10
10
  django_bulk_hooks/models.py,sha256=exnXYVKEVbYAXhChCP8VdWTnKCnm9DiTcokEIBee1I0,4350
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=H9toczyQ4KZUGSi-M594vF3BRaSVQX-tqKb6GHe7ua0,32648
13
- django_bulk_hooks/registry.py,sha256=T8ET5VGgvcRKhf5fuFXE8pNzWfkiIWN1QEGT-HyIS_E,957
14
- django_bulk_hooks-0.1.220.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.220.dist-info/METADATA,sha256=zCKNbtprnajlqueQU707WJtzREhFTmKzScxioyab0-U,9061
16
- django_bulk_hooks-0.1.220.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- django_bulk_hooks-0.1.220.dist-info/RECORD,,
12
+ django_bulk_hooks/queryset.py,sha256=YSDCMAf24YLeLJrRKCDYwbZInP2mK_Tcuw3EHLDkv_w,32605
13
+ django_bulk_hooks/registry.py,sha256=8UuhniiH5ChSeOKV1UUbqTEiIu25bZXvcHmkaRbxmME,1131
14
+ django_bulk_hooks-0.1.221.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.221.dist-info/METADATA,sha256=QVFXKdg3v7WcK1IsfDD3h3Nijg3tXdHtlqS6JoGemFo,9061
16
+ django_bulk_hooks-0.1.221.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ django_bulk_hooks-0.1.221.dist-info/RECORD,,