Skip to content

Commit

Permalink
[STTNHUB-356] fix: Unable to send empty value for UserForm (#1045)
Browse files Browse the repository at this point in the history
* [STTNHUB-356] fix: Unable to send empty value for UserForm
Was causing the following exception to be raised
```
  File "newsroom/users/forms.py", line 22, in process_formdata
    self.data = [x.strip() for x in valuelist[0].split(",")]
AttributeError: 'NoneType' object has no attribute 'split'
```

* fix formatting
  • Loading branch information
MarkLark86 authored and petrjasek committed Aug 22, 2024
1 parent 613959a commit ab520ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion newsroom/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def _value(self):
return ""

def process_formdata(self, valuelist):
if valuelist == [""]: # An empty string from the client is equal to an empty array
if (
valuelist == [""] or valuelist == [None] or valuelist == ["None"]
): # An empty string from the client is equal to an empty array
self.data = []
elif len(valuelist):
self.data = [x.strip() for x in valuelist[0].split(",")]
Expand Down

0 comments on commit ab520ce

Please sign in to comment.