Exclude local variables

This commit is contained in:
Alex Root Junior 2017-05-30 22:42:50 +03:00
parent adb8d8c17a
commit 3b416a1e0e

View file

@ -4,4 +4,7 @@ DEFAULT_FILTER = ['self']
def generate_payload(exclude=None, **kwargs):
if exclude is None:
exclude = []
return {key: value for key, value in kwargs.items() if key not in exclude + DEFAULT_FILTER and value}
return {key: value for key, value in kwargs.items() if
key not in exclude + DEFAULT_FILTER
and value
and not key.startswith('_')}