Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[djangoproject.com] made feed aggregator more robust. Man, you can't …

…slip *anything* by Malcolm.

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@7893 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 36e1a63a5c2676d34a3ca8a023f839fd590a6e88 1 parent 6e6842e
jacob authored
Showing with 12 additions and 9 deletions.
  1. +12 −9 django_website/apps/aggregator/bin/update_feeds.py
View
21 django_website/apps/aggregator/bin/update_feeds.py
@@ -53,19 +53,22 @@ def update_feeds(verbose=False):
except FeedItem.DoesNotExist:
feed.feeditem_set.create(title=title, link=link, summary=content, guid=guid, date_modified=date_modified)
-if __name__ == '__main__':
- try:
- lockfile = os.open(LOCKFILE, os.O_CREAT | os.O_EXCL)
- except OSError:
- sys.exit(0)
-
+def main(argv):
parser = optparse.OptionParser()
parser.add_option('--settings')
parser.add_option('-v', '--verbose', action="store_true")
- options, args = parser.parse_args()
+ options, args = parser.parse_args(argv)
if options.settings:
os.environ["DJANGO_SETTINGS_MODULE"] = options.settings
update_feeds(options.verbose)
- os.close(lockfile)
- os.unlink(LOCKFILE)
+if __name__ == '__main__':
+ try:
+ lockfile = os.open(LOCKFILE, os.O_CREAT | os.O_EXCL)
+ except OSError:
+ sys.exit(0)
+ try:
+ sys.exit(main(sys.argv))
+ finally:
+ os.close(lockfile)
+ os.unlink(LOCKFILE)
Please sign in to comment.
Something went wrong with that request. Please try again.