Skip to content

pass kwargs when sending signals #1206

@richunger

Description

@richunger

For example, when sending pre_save:

signals.pre_save.send(self.__class__, document=self)

it would be convenient if kwargs was passed as well, so that application code could pass information from save to signal handlers, like:

self.save('some_flag'=True)
...
def pre_save(self, **kwargs):
  ...
  if kwargs.get('some_flag'):
    ...

Workaround right now is to hang it off of _data:

self._data['_some_flag']=True
self.save()
...
def pre_save(self, **kwargs):
  ...
  if self._data.get('_some_flag'):
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions