def handle(self, *args, **options): urls = list(map(str.strip, fileinput.input(args))) try: examples = ExamplePodcasts.get(EXAMPLES_DOCID) except ResourceNotFound: examples = ExamplePodcasts() examples._id = EXAMPLES_DOCID podcasts = filter(None, [Podcast.for_url(url) for url in urls]) examples.podcast_ids = [podcast.get_id() for podcast in podcasts] examples.updated = datetime.utcnow() examples.save()