#97 String-type config options set to empty string shouldn't turn into None
Merged 7 years ago by merlinthp. Opened 7 years ago by merlinthp.
merlinthp/ipsilon master  into  master

file modified
+1 -1
@@ -133,7 +133,7 @@ 

          raise NotImplementedError

  

      def _str_export_value(self):

-         if self._assigned_value:

+         if self._assigned_value is not None:

              return str(self._assigned_value)

          return None

  

Without this, if we try to set a string-type config option to '' it becomes
None. When code expecting a string uses this value, it ends up expanding
out to 'None' in various places, including the plugin configuration pages.

Signed-off-by: Howard Johnson merlin@merlinthp.org

Simple reproducer for the issue:

  • Take a fresh master checkout
  • Run quickrun.py
  • Log in as admin
  • Go to the configuration page of the testauth plugin
  • Blank out the 'help text' field, and hit Save.

The empty field turns into 'None' on page reload. If you log out, then navigate back to the login page, you'll see the help text is now 'None'.

This patch looks good to me.

Commit c873faa fixes this pull-request

Pull-Request has been merged by merlin@merlinthp.org

7 years ago
Metadata