We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cd21e1 commit ddcd1f9Copy full SHA for ddcd1f9
qencode/utils.py
@@ -28,9 +28,10 @@ def is_json(value):
28
29
30
def rm_attributes_if_null(class_obj):
31
- for key, val in class_obj.__dict__.items():
32
- if not val:
33
- class_obj.__dict__.pop(key)
+ attrs = list(key for key in class_obj.__dict__.keys() if not key.startswith('__'))
+ for attr in attrs:
+ if getattr(class_obj, attr, None) is None:
34
+ delattr(class_obj, attr)
35
36
37
def rm_key_if_null(obj):
0 commit comments