From 562f0ea8be2669284eecc4af537162e8eaa02555 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 30 Jun 2010 20:08:49 -0400 Subject: [PATCH] Use re.DOTALL to also match newlines with . --- sitecore/alt_tags.py | 3 ++- sitecore/prof/import.py | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/sitecore/alt_tags.py b/sitecore/alt_tags.py index 11aa9d8..df4a4f8 100644 --- a/sitecore/alt_tags.py +++ b/sitecore/alt_tags.py @@ -47,7 +47,8 @@ def add_headshot_alt_tags(s): except NoSuchElementException, e: s.logger.info("can't lock %s (already locked?), skipping" % raw_name) continue - alt_granddad,alt_tag = s.find_field(re.compile('.*Alt:.*'), 'Alt') + alt_granddad,alt_tag = s.find_field( + re.compile('.*Alt:.*', re.DOTALL), 'Alt') alt_tag.clear() alt_tag.send_keys(name) s.publish_section('Added alt tag for %s' % name) diff --git a/sitecore/prof/import.py b/sitecore/prof/import.py index 9144b5e..4c164f7 100644 --- a/sitecore/prof/import.py +++ b/sitecore/prof/import.py @@ -38,25 +38,26 @@ class ProfessorAdder (object): def __init__(self, sitecore_connection): self.s = sitecore_connection self.regexps = { - 'Degrees':re.compile('Degrees:.*'), - 'College':re.compile('College:.*'), - 'Program':re.compile('Program:.*'), - 'Office':re.compile('Office:.*'), - 'Specialization':re.compile('.*Specialization:.*'), - 'Research Interests':re.compile('.*Research Interests:.*'), - 'Personal Site':re.compile('.*Personal Site:.*'), - 'Title':re.compile('.*Title:.*'), - 'First Name':re.compile('.*First Name:.*'), - 'Last Name':re.compile('.*Last Name:.*'), - 'Bio':re.compile('.*Bio:.*'), - 'Headshot':re.compile('.*Headshot:.*'), - 'Email':re.compile('.*Email:.*'), - 'Phone':re.compile('.*Phone:.*'), - 'Fax':re.compile('.*Fax:.*'), - 'Page Title':re.compile('.*Page Title -.*'), - 'Menu Title':re.compile('.*Menu Title -.*'), - 'Breadcrumb Title':re.compile('.*Breadcrumb Title -.*'), - 'See Also Title':re.compile('.*See Also title -.*'), + 'Degrees':re.compile('Degrees:.*', re.DOTALL), + 'College':re.compile('College:.*', re.DOTALL), + 'Program':re.compile('Program:.*', re.DOTALL), + 'Office':re.compile('Office:.*', re.DOTALL), + 'Specialization':re.compile('.*Specialization:.*', re.DOTALL), + 'Research Interests':re.compile('.*Research Interests:.*', + re.DOTALL), + 'Personal Site':re.compile('.*Personal Site:.*', re.DOTALL), + 'Title':re.compile('.*Title:.*', re.DOTALL), + 'First Name':re.compile('.*First Name:.*', re.DOTALL), + 'Last Name':re.compile('.*Last Name:.*', re.DOTALL), + 'Bio':re.compile('.*Bio:.*', re.DOTALL), + 'Headshot':re.compile('.*Headshot:.*', re.DOTALL), + 'Email':re.compile('.*Email:.*', re.DOTALL), + 'Phone':re.compile('.*Phone:.*', re.DOTALL), + 'Fax':re.compile('.*Fax:.*', re.DOTALL), + 'Page Title':re.compile('.*Page Title -.*', re.DOTALL), + 'Menu Title':re.compile('.*Menu Title -.*', re.DOTALL), + 'Breadcrumb Title':re.compile('.*Breadcrumb Title -.*', re.DOTALL), + 'See Also Title':re.compile('.*See Also title -.*', re.DOTALL), } def setup(self): -- 2.26.2