From 7aee3fb920a1477332d78c8f3fb546da428be6e8 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 13 May 2009 05:25:17 +0100 Subject: [svn] QM parser now parses Hauchhoehle QMs.py Photo model added. Logbook parser now puts mugshots in as photo models, and descriptions from the old folk html pages in as "blurbs" on the person model. Experimented with eye candy and a random logbook quote generator. Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8094 by aaron @ 12/31/2008 2:59 AM --- parsers/logbooks.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'parsers/logbooks.py') diff --git a/parsers/logbooks.py b/parsers/logbooks.py index d0d4f4c..75caeaf 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -45,10 +45,37 @@ def LoadPersons(): pObject = models.Person(first_name = firstname, last_name = lastname, is_vfho = person[header["VfHO member"]], - mug_shot = person[header["Mugshot"]]) - pObject.save() + ) + is_guest = person[header["Guest"]] == "1" # this is really a per-expo catagory; not a permanent state + pObject.save() + #create mugshot Photo instance + mugShotPath = settings.EXPOWEB+"folk/"+person[header["Mugshot"]] + if mugShotPath[-3:]=='jpg': #if person just has an image, add it + mugShotObj = models.Photo( + caption="Mugshot for "+firstname+" "+lastname, + is_mugshot=True, + file=mugShotPath, + ) + mugShotObj.save() + mugShotObj.contains_person.add(pObject) + mugShotObj.save() + elif mugShotPath[-3:]=='htm': #if person has an html page, find the image(s) and add it. Also, add the text from the html page to the "blurb" field in his model instance. + personPageOld=open(mugShotPath,'r').read() + pObject.blurb=re.search('.*