Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2008-09-12 04:31:35 (GMT)
committer Marco Pesenti Gritti <mpgritti@gmail.com>2008-09-13 13:52:30 (GMT)
commit7cc64d29ebf74c1e80f6e4f0e363aa114ff36890 (patch)
tree81c2ea5132090fb84c9b0d32e826450e834a3f39
parent3603d084b33ca6eca85b02706d23744a043374f4 (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.
-rw-r--r--src/controlpanel/model/datetime.py4
-rw-r--r--src/controlpanel/model/language.py4
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: