Browse Source

fix: 'NoneType' object has no attribute 'replace'

Caused by changes how way 'StringField' is handling the default value in 'wtforms' >= 3.0.0.
In previous versions, 'None' was changed to an empty string, now it stays 'None'.
Logic added to set the affected variable to 'str()'.

References:
https://github.com/wtforms/wtforms/commit/29c60458f3809bb43fb4007cfe710f3d7f4067d4
https://github.com/wtforms/wtforms/issues/291
Dominik Wombacher 1 year ago
parent
commit
d269390c91
1 changed files with 1 additions and 1 deletions
  1. 1 1
      pagure/ui/repo.py

+ 1 - 1
pagure/ui/repo.py

@@ -2598,7 +2598,7 @@ def edit_file(repo, branchname, filename, username=None, namespace=None):
                 branch=branchname,
                 branchto=form.branch.data,
                 filename=filename,
-                content=form.content.data,
+                content=form.content.data if form.content.data else str(),
                 message="%s\n\n%s"
                 % (
                     form.commit_title.data.strip(),