summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorgoatchurch <devnull@localhost>2009-07-21 07:20:34 +0100
committergoatchurch <devnull@localhost>2009-07-21 07:20:34 +0100
commite5033c7b69a2210087c502b54c5fd07d57c5a0d2 (patch)
tree00f9488a017a525f8d986d96a6cf5bf8d3c70daa /utils.py
parent8bede4b5ce44269906e60da81833f0e4b835cbbb (diff)
downloadtroggle-e5033c7b69a2210087c502b54c5fd07d57c5a0d2.tar.gz
troggle-e5033c7b69a2210087c502b54c5fd07d57c5a0d2.tar.bz2
troggle-e5033c7b69a2210087c502b54c5fd07d57c5a0d2.zip
[svn] bugged
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils.py b/utils.py
index 1638cd2..69aa9c8 100644
--- a/utils.py
+++ b/utils.py
@@ -50,13 +50,13 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
instance.save()
if created:
- logging.info(unicode(instance)+u' was just added to the database for the first time. \n')
+ logging.info(str(instance) + ' was just added to the database for the first time. \n')
if not created and instance.new_since_parsing:
- logging.info(unicode(instance)+" has been modified using Troggle, so the current script left it as is. \n")
+ logging.info(str(instance) + " has been modified using Troggle, so the current script left it as is. \n")
if not created and not instance.new_since_parsing:
- logging.info(unicode(instance)+" existed in the database unchanged since last parse. It was overwritten by the current script. \n")
+ logging.info(str(instance) + " existed in the database unchanged since last parse. It was overwritten by the current script. \n")
return (instance, created)
def render_with_context(req, *args, **kwargs):
@@ -119,7 +119,9 @@ re_subs = [(re.compile(r"\<b[^>]*\>(.*?)\</b\>", re.DOTALL), r"'''\1'''"),
#interpage link needed
(re.compile(r"\<a\s+href=['\"]#([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are subcaves. Not great.
(re.compile(r"\[\<a\s+href=['\"][^'\"]*['\"]\s+id=['\"][^'\"]*['\"]\s*\>([^\s]*).*?\</a\>\]", re.DOTALL), r"[[qm:\1]]"),
- (re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks)
+
+# BUGGED!
+# (re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks)
]
@@ -169,6 +171,7 @@ def html_to_wiki(text, codec = "utf-8"):
else:
out += text
text = ""
+
#substitutions
for regex, repl in re_subs:
out = regex.sub(repl, out)