def publish(self): entry = self.entry = yield self.entry.key.get_async() if not self.entry.published: self.entry.published_post = True self.entry.published = True self.entry.published_at = datetime.now() yield self.entry.put_async() data = instagram_format_for_adn(self.feed, self.entry) path = 'posts' deferred.defer(publish_to_api, entry.key.urlsafe(), self.feed.key.urlsafe(), path, data, self.user.access_token, _transactional=True, _retry_options=api_publish_opts, _target='backend', _url='/api/backend/deferred/task')
def format_entry_for_adn(self, entry, for_publish=False): post = instagram_format_for_adn(self, entry) raise ndb.Return([(post, 'post')])