diff options
author | C. Scott Ananian <cscott@laptop.org> | 2008-09-12 04:31:35 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-09-13 13:54:41 (GMT) |
commit | 19f5f733dcbefdfc5ba6fdf9824196e19a269eb3 (patch) | |
tree | 3d4f3e90ee31ebbf4c3d660de5ca2f99c16188df /src | |
parent | 63a997442dd7fe87cdd2e4a47e44d0a5ab1807fc (diff) |
Trac #8438: python -OO fails in control panel.
There are two places in control panel code where we manipulate __doc__
strings directly with '+='. When python is run with -OO, the __doc__
strings are None, and so += of None and a str fails.
Diffstat (limited to 'src')
-rw-r--r-- | src/controlpanel/model/datetime.py | 4 | ||||
-rw-r--r-- | src/controlpanel/model/language.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/controlpanel/model/datetime.py b/src/controlpanel/model/datetime.py index a449fd0..4a4c560 100644 --- a/src/controlpanel/model/datetime.py +++ b/src/controlpanel/model/datetime.py @@ -29,6 +29,10 @@ _zone_tab = '/usr/share/zoneinfo/zone.tab' def _initialize(): '''Initialize the docstring of the set function''' + if set_timezone.__doc__ is None: + # when running under 'python -OO', all __doc__ fields are None, + # so += would fail -- and this function would be unnecessary anyway. + return timezones = read_all_timezones() for timezone in timezones: set_timezone.__doc__ += timezone + '\n' diff --git a/src/controlpanel/model/language.py b/src/controlpanel/model/language.py index d835f77..404d9dd 100644 --- a/src/controlpanel/model/language.py +++ b/src/controlpanel/model/language.py @@ -53,6 +53,10 @@ def read_all_languages(): return locales def _initialize(): + if set_language.__doc__ is None: + # when running under 'python -OO', all __doc__ fields are None, + # so += would fail -- and this function would be unnecessary anyway. + return languages = read_all_languages() set_language.__doc__ += '\n' for lang in languages: |