[Bug #945063] Get file extension correct.  (2.3 bugfix candidate)
diff --git a/Lib/cgitb.py b/Lib/cgitb.py
index ab4c598..c65783f 100644
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -274,7 +274,7 @@
 
         if self.logdir is not None:
             import os, tempfile
-            suffix = ['.html', '.txt'][self.format=="html"]
+            suffix = ['.txt', '.html'][self.format=="html"]
             (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir)
             try:
                 file = os.fdopen(fd, 'w')