Пример #1
0
 def publish_pdfs(self, *args, **kwargs):
     if self.jackfrost_can_build():
         try:
             read, written = build_single(self.get_pdf_url())
             slack_message('slack/message.slack', {
                 'message': 'published %s %s' % (self.content_model, self.title),
                 'color': '#00adbc'
             })
             yield json.dumps(written)
             yield '\n'
         except Exception, e:
             yield json.dumps(e.message)
             yield '\n'
             logger.exception('Failed to publish PDF for %s' % self)
Пример #2
0
 def publish(self, children=False, silent=False):
     if self.jackfrost_can_build():
         for url in self.jackfrost_urls():
             try:
                 read, written = build_single(url)
                 if not silent:
                     slack_message('slack/message.slack', {
                         'message': 'published %s %s' % (self.content_model, self.title),
                         'color': '#00adbc'
                     })
                 yield json.dumps(written)
                 yield '\n'
             except Exception, e:
                 yield json.dumps(e.message)
                 yield '\n'
                 logger.exception('Failed to publish %s' % url)
Пример #3
0
 def publish(self, children=False):
     if children:
         for lesson in self.lesson_set.all():
             for result in lesson.publish():
                 yield result
     if self.jackfrost_can_build():
         for url in self.jackfrost_urls():
             try:
                 read, written = build_single(url)
                 slack_message('slack/message.slack', {
                     'message': 'published %s %s %s' % (self.content_model, self.title, url),
                     'color': '#00adbc'
                 })
                 yield json.dumps(written)
                 yield '\n'
             except Exception, e:
                 yield json.dumps(e.message)
                 yield '\n'
                 logger.exception('Failed to publish %s' % self)