コード例 #1
0
def build_static_site(static_site):
    static_site.state = StaticSiteState.running
    db.session.commit()
    try:
        logger.info('Building static site: %s', static_site)
        session.lang = static_site.creator.settings.get('lang')
        rh = RH()
        g.rh = rh
        g.static_site = True

        zip_file_path = create_static_site(rh, static_site.event)
        static_site.state = StaticSiteState.success
        static_site.content_type = 'application/zip'
        static_site.filename = 'offline_site_{}.zip'.format(
            static_site.event.id)
        with open(zip_file_path, 'rb') as f:
            static_site.save(f)
        db.session.commit()

        logger.info('Building static site successful: %s', static_site)
        g.static_site = False
        g.rh = None
        notify_static_site_success(static_site)
    except Exception:
        logger.exception('Building static site failed: %s', static_site)
        static_site.state = StaticSiteState.failed
        db.session.commit()
        raise
    finally:
        g.static_site = False
        g.rh = None
コード例 #2
0
ファイル: display.py プロジェクト: www3838438/indico
 def _process(self):
     return RH._process(self)
コード例 #3
0
ファイル: display.py プロジェクト: DirkHoffmann/indico
 def _process(self):
     return RH._process(self)