Skip to content

DataWatch is using TypeError to detect the arity of callback function #475

Open
@liudangyi

Description

@liudangyi

In kazoo/recipe/watchers.py line 163.

            try:
                result = self._func(data, stat, event)
            except TypeError:
                result = self._func(data, stat)

It's too terrible since a lot of error could raise a TypeError. Two better ways may be

  1. Like ChildrenWatch, add a send_event parameter.
  2. Use len(inspect.getargspec(self._func).args) to decide the arity first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions