Author: jacob
Date: 2008-07-11 10:29:35 -0500 (Fri, 11 Jul 2008)
New Revision: 7893
Modified:
djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py
Log:
[djangoproject.com] made feed aggregator more robust. Man, you can't slip
*anything* by Malcolm.
Modified: djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py
===================================================================
--- djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py
2008-07-11 15:19:27 UTC (rev 7892)
+++ djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py
2008-07-11 15:29:35 UTC (rev 7893)
@@ -53,19 +53,22 @@
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)
\ No newline at end of file
+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)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---