summaryrefslogtreecommitdiffstats
path: root/parsers/subcaves.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-07-04 08:27:49 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-07-04 08:27:49 +0100
commitdd76a1a0be0345bf1a2330cefe299af92b9a5721 (patch)
tree8f0956a3763bbdbfaf29f88e5bc9d2463b30fc00 /parsers/subcaves.py
parentc132477f80342a5174719922889fc04056de482e (diff)
downloadtroggle-dd76a1a0be0345bf1a2330cefe299af92b9a5721.tar.gz
troggle-dd76a1a0be0345bf1a2330cefe299af92b9a5721.tar.bz2
troggle-dd76a1a0be0345bf1a2330cefe299af92b9a5721.zip
[svn] * Adding JS fill in next QM number via ajax.
* Slight models cleanup- get rid of TroggleImageModel class, use mixin instead. * Collect various troggle shared functions into utils.py
Diffstat (limited to 'parsers/subcaves.py')
-rw-r--r--parsers/subcaves.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/parsers/subcaves.py b/parsers/subcaves.py
index c3acc4d..bdd64a1 100644
--- a/parsers/subcaves.py
+++ b/parsers/subcaves.py
@@ -37,7 +37,20 @@ def importSubcaves(cave):
logging.info("Added " + unicode(newSubcave) + " to " + unicode(cave))
except IOError:
logging.info("Subcave import couldn't open "+subcaveFilePath)
-
+
+def getLinksInSubcaveDescription(subcave):
+ pattern='<a href=\"(.*?)\">(.*?)</a>'
+ if subcave.description:
+ return re.findall(pattern,subcave.description)
+ else:
+ return []
+
+def getLinksInAllSubcaves():
+ bigList=[]
+ for subcave in Subcave.objects.all():
+ bigList+=getLinksInSubcaveDescription(subcave)
+ return bigList
+
def importAllSubcaves():
for cave in Cave.objects.all():
importSubcaves(cave)