From: W. Trevor King Date: Thu, 24 Jun 2010 20:34:17 +0000 (-0400) Subject: Don't worry about sections that we can't lock X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9580d09b00fee2022279f90247d8567a416006ec;p=sitecorepy.git Don't worry about sections that we can't lock --- diff --git a/sitecore.py b/sitecore.py index 994f26b..6d864fd 100755 --- a/sitecore.py +++ b/sitecore.py @@ -33,6 +33,7 @@ import logging import time from selenium.firefox.webdriver import WebDriver +from selenium.common.exceptions import NoSuchElementException class SiteCoreConnection (object): @@ -176,7 +177,11 @@ def add_headshot_alt_tags(s): name = ' '.join([x.capitalize() for x in raw_name.split('_')]) s.logger.info('setting alt tag "%s" for %s' % (name, raw_name)) s.open_nav_section(raw_name) - s.lock_section() + try: + s.lock_section() + except NoSuchElementException, e: + s.logger.info("can't lock %s (already locked?), skipping" % raw_name) + continue alt_granddad,alt_tag = s.find_field('Alt:') alt_tag.clear() alt_tag.send_keys(name)