summaryrefslogtreecommitdiffstats
path: root/parsers/people.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/people.py')
-rw-r--r--parsers/people.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/parsers/people.py b/parsers/people.py
index cb9f79f..265dacc 100644
--- a/parsers/people.py
+++ b/parsers/people.py
@@ -7,34 +7,35 @@ from utils import save_carefully
from HTMLParser import HTMLParser
from unidecode import unidecode
-def saveMugShot(mugShotPath, mugShotFilename, person):
- if mugShotFilename.startswith(r'i/'): #if filename in cell has the directory attached (I think they all do), remove it
- mugShotFilename=mugShotFilename[2:]
- else:
- mugShotFilename=mugShotFilename # just in case one doesn't
+# def saveMugShot(mugShotPath, mugShotFilename, person):
+ # if mugShotFilename.startswith(r'i/'): #if filename in cell has the directory attached (I think they all do), remove it
+ # mugShotFilename=mugShotFilename[2:]
+ # else:
+ # mugShotFilename=mugShotFilename # just in case one doesn't
- dummyObj=models.DPhoto(file=mugShotFilename)
+ # dummyObj=models.DPhoto(file=mugShotFilename)
- #Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py
- if not os.path.exists(dummyObj.file.path):
- shutil.copy(mugShotPath, dummyObj.file.path)
+ # #Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py
+ # if not os.path.exists(dummyObj.file.path):
+ # shutil.copy(mugShotPath, dummyObj.file.path)
- mugShotObj, created = save_carefully(
- models.DPhoto,
- lookupAttribs={'is_mugshot':True, 'file':mugShotFilename},
- nonLookupAttribs={'caption':"Mugshot for "+person.first_name+" "+person.last_name}
- )
+ # mugShotObj, created = save_carefully(
+ # models.DPhoto,
+ # lookupAttribs={'is_mugshot':True, 'file':mugShotFilename},
+ # nonLookupAttribs={'caption':"Mugshot for "+person.first_name+" "+person.last_name}
+ # )
- if created:
- mugShotObj.contains_person.add(person)
- mugShotObj.save()
+ # if created:
+ # mugShotObj.contains_person.add(person)
+ # mugShotObj.save()
def parseMugShotAndBlurb(personline, header, person):
"""create mugshot Photo instance"""
mugShotFilename=personline[header["Mugshot"]]
mugShotPath = os.path.join(settings.EXPOWEB, "folk", mugShotFilename)
if mugShotPath[-3:]=='jpg': #if person just has an image, add it
- saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person)
+ #saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person)
+ pass
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()
if not person.blurb:
@@ -45,9 +46,9 @@ def parseMugShotAndBlurb(personline, header, person):
person.blurb=re.search('<body>.*<hr',personPageOld,re.DOTALL).group()
else:
print "ERROR: --------------- Broken link or Blurb parse error in ", mugShotFilename
- for mugShotFilename in re.findall('i/.*?jpg',personPageOld,re.DOTALL):
- mugShotPath = os.path.join(settings.EXPOWEB, "folk", mugShotFilename)
- saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person)
+ #for mugShotFilename in re.findall('i/.*?jpg',personPageOld,re.DOTALL):
+ # mugShotPath = os.path.join(settings.EXPOWEB, "folk", mugShotFilename)
+ # saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person)
person.save()
def LoadPersonsExpos():