From 0a5c27be02429f5fb00be79c4e11b70666713530 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Sat, 2 May 2009 11:19:14 +0200 Subject: [PATCH] Restore compatibility with Python 2.5 --- geekigeeki.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geekigeeki.py b/geekigeeki.py index 678754e..470752d 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -324,7 +324,7 @@ def make_index_key(): links = ['%s' % (ch, ch) for ch in 'abcdefghijklmnopqrstuvwxyz'] return '

' + ' | '.join(links) + '

' -def page_list(dirname = None, re = None): +def page_list(dirname=None, re=None): if re is None: # FIXME: WikiWord is too restrictive now! re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$") @@ -623,7 +623,7 @@ class Page: try: os.stat(self._filename()) return True - except OSError as err: + except OSError, err: if err.errno == errno.ENOENT: return False raise err @@ -631,7 +631,7 @@ class Page: def get_raw_body(self, default=None): try: return open(self._filename(), 'rb').read() - except IOError as err: + except IOError, err: if err.errno == errno.ENOENT: if default is None: default = '//[[%s|Describe %s|action=edit]]//' % (self.page_name, self.page_name) @@ -669,7 +669,7 @@ class Page: break self._pragmas[m.group(1)] = m.group(2).strip() #print "bernie: pragmas[" + m.group(1) + "] = " + m.group(2) + "
\n" - except IOError as err: + except IOError, err: if err.errno != errno.ENOENT and err.errno != errno.EISDIR: raise er return self._pragmas @@ -720,7 +720,7 @@ class Page: try: from time import localtime, strftime modtime = localtime(os.stat(self._filename())[stat.ST_MTIME]) - except OSError as err: + except OSError, err: if err.errno != errno.ENOENT: raise err return None @@ -791,7 +791,7 @@ class Page: # Bad Bill! POSIX rename ought to replace. :-( try: os.remove(name) - except OSError as err: + except OSError, err: if err.errno != errno.ENOENT: raise err os.rename(tmp_filename, name) -- 2.25.1