Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

OptionalFunction only calls its wrapped function if the data is non-None

  • Loading branch information...
commit 7c561ba97a1ebfa6351b67d6fc58aa812cd801ca 1 parent d2ff8f8
jay groven authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 jsonvalidator/__init__.py
View
5 jsonvalidator/__init__.py
@@ -87,8 +87,9 @@ class OptionalFunction(object):
def __init__(self, fn):
self.__fn = fn
- def __call__(self, *args, **kwargs):
- return self.__fn(*args, **kwargs)
+ def __call__(self, data):
+ if data is not None:
+ return self.__fn(data)
class JSONValidationError(Exception):
pass
Please sign in to comment.
Something went wrong with that request. Please try again.