summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:58:58 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:58:58 +0100
commit90da85e8563298a23e860db08db952f9a6b46f2d (patch)
tree1686e07bdbdcf5468c9fe49d352f02e02221f14a /parsers/logbooks.py
parente8da6b9b8b0d5390d26832af42550c4e651a82dd (diff)
downloadtroggle-90da85e8563298a23e860db08db952f9a6b46f2d.tar.gz
troggle-90da85e8563298a23e860db08db952f9a6b46f2d.tar.bz2
troggle-90da85e8563298a23e860db08db952f9a6b46f2d.zip
[svn] revert some of the changes (href element) so that the links work
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8267 by julian @ 3/11/2009 10:44 AM
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index c2c46a4..6830893 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -198,7 +198,7 @@ def Parseloghtml01(year, expedition, txt):
#print ldate, trippeople.strip()
- # could includ the tripid (url link for cross referencing)
+ # could include the tripid (url link for cross referencing)
EnterLogIntoDbase(date = ldate, place = tripcave, title = triptitle, text = ltriptext, trippeople=trippeople, expedition=expedition, logtime_underground=0)
@@ -245,6 +245,9 @@ yearlinks = [
("1998", "1998/log.htm", Parseloghtml01),
("1997", "1997/log.htm", Parseloghtml01),
("1996", "1996/log.htm", Parseloghtml01),
+ ("1995", "1995/log.htm", Parseloghtml01),
+ ("1994", "1994/log.htm", Parseloghtml01),
+ ("1993", "1993/log.htm", Parseloghtml01),
]
def SetDatesFromLogbookEntries(expedition):
@@ -255,22 +258,25 @@ def SetDatesFromLogbookEntries(expedition):
personexpedition.save()
# The below is all unnecessary, just use the built in get_previous_by_date and get_next_by_date
-# lprevpersontrip = None
-# for persontrip in persontrips:
-# persontrip.persontrip_prev = lprevpersontrip
-# if lprevpersontrip:
-# lprevpersontrip.persontrip_next = persontrip
-# lprevpersontrip.save()
-# persontrip.persontrip_next = None
-# lprevpersontrip = persontrip
-# persontrip.save()
+# it might be if it f***ing worked! but it doesn't does it!
+ lprevpersontrip = None
+ for persontrip in persontrips:
+ persontrip.persontrip_prev = lprevpersontrip
+ if lprevpersontrip:
+ lprevpersontrip.persontrip_next = persontrip
+ lprevpersontrip.save()
+ persontrip.persontrip_next = None
+ lprevpersontrip = persontrip
+ persontrip.save()
- # from trips rather than logbook entries, which may include events outside the expedition
+ # from trips rather than logbook entries, which may include events outside the expedition (so what?)
expedition.date_from = min([personexpedition.date_from for personexpedition in expedition.personexpedition_set.all() if personexpedition.date_from] or [None])
expedition.date_to = max([personexpedition.date_to for personexpedition in expedition.personexpedition_set.all() if personexpedition.date_to] or [None])
expedition.save()
# The below has been replaced with the methods get_next_by_id and get_previous_by_id
+# (this might be true, but it's sort of in the order of the logbook.
+# [Maybe we'd want to sort it by date and display it in that order, in which case it's tough luck! - JGT]
# # order by appearance in the logbook (done by id)
# lprevlogbookentry = None
# for logbookentry in expedition.logbookentry_set.order_by('id'):
@@ -282,7 +288,9 @@ def SetDatesFromLogbookEntries(expedition):
# logbookentry.save()
# lprevlogbookentry = logbookentry
-# This combined date / number key is a weird way of doing things. Use the primary key instead. If we are going to use the date for looking up entries, we should set it up to allow multiple results.
+# This combined date / number key is a weird way of doing things. Use the primary key instead.
+# If we are going to use the date for looking up entries, we should set it up to allow multiple results.
+# [Not weird. Very common. A date is meaningful and almost gets there. Simply needs small amount of disambiguation to make it a primary key -- JGT]
# # order by date for setting the references
# lprevlogbookentry = None
# for logbookentry in expedition.logbookentry_set.order_by('date'):
@@ -317,7 +325,7 @@ def LoadLogbooks():
models.LogbookEntry.objects.all().delete()
expowebbase = os.path.join(settings.EXPOWEB, "years")
#yearlinks = [ ("2001", "2001/log.htm", Parseloghtml01), ] #overwrite
- #yearlinks = [ ("1996", "1996/log.htm", Parseloghtml01),] # overwrite
+ #yearlinks = [ ("1993", "1993/log.htm", Parseloghtml01),] # overwrite
for year, lloc, parsefunc in yearlinks:
expedition = models.Expedition.objects.filter(year = year)[0]
@@ -327,4 +335,3 @@ def LoadLogbooks():
parsefunc(year, expedition, txt)
SetDatesFromLogbookEntries(expedition)
-