From dc30f80ce45f98b1c310b75391833214bf7d076f Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 22 Jul 2009 16:35:49 +0100 Subject: [PATCH] [svn] fix indexError bug julian found --- utils.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/utils.py b/utils.py index b6ecf40..6f62b0c 100644 --- a/utils.py +++ b/utils.py @@ -99,7 +99,7 @@ def href_to_wikilinks(matchobj): object actually exists. """ res=CaveDescription.objects.filter(long_name__icontains=matchobj.groupdict()['text']) - if res: + if res[0]: return r'[[cavedescription:'+res[0].short_name+'|'+res[0].long_name+']]' else: return matchobj.group() @@ -120,11 +120,8 @@ re_subs = [(re.compile(r"\]*\>(.*?)\", re.DOTALL), r"'''\1'''"), #interpage link needed (re.compile(r"\(.*?)\", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are cave descriptions. Not great. (re.compile(r"\[\([^\s]*).*?\\]", re.DOTALL), r"[[qm:\1]]"), - - #BUGGED! (re.compile(r'.*)"?>(?P.*)'),href_to_wikilinks), - ] def html_to_wiki(text, codec = "utf-8"): @@ -173,7 +170,6 @@ def html_to_wiki(text, codec = "utf-8"): else: out += text text = "" - #substitutions for regex, repl in re_subs: out = regex.sub(repl, out)