Пример #1
0
 def _process(self):
     sprite_mapping = rb_cache.get('rooms-sprite-mapping')
     if sprite_mapping is None:
         build_rooms_spritesheet()
     if 'version' not in request.view_args:
         return redirect(
             url_for('.sprite', version=rb_cache.get('rooms-sprite-token')))
     photo_data = rb_cache.get('rooms-sprite')
     return send_file('rooms-sprite.jpg',
                      BytesIO(photo_data),
                      'image/jpeg',
                      no_cache=False,
                      cache_timeout=365 * 86400)
Пример #2
0
def remove_room_spritesheet_photo(room):
    from indico.modules.rb import rb_cache
    mapping = rb_cache.get('rooms-sprite-mapping')
    if not mapping or room.id not in mapping:
        return
    del mapping[room.id]
    rb_cache.set('rooms-sprite-mapping', mapping)
Пример #3
0
 def _process(self):
     tos_url = legal_settings.get('tos_url')
     tos_html = sanitize_html(legal_settings.get('tos')) or None
     privacy_policy_url = legal_settings.get('privacy_policy_url')
     privacy_policy_html = sanitize_html(
         legal_settings.get('privacy_policy')) or None
     if tos_url:
         tos_html = None
     if privacy_policy_url:
         privacy_policy_html = None
     return jsonify(
         rooms_sprite_token=str(rb_cache.get('rooms-sprite-token', '')),
         languages=get_all_locales(),
         tileserver_url=rb_settings.get('tileserver_url'),
         grace_period=rb_settings.get('grace_period'),
         managers_edit_rooms=rb_settings.get('managers_edit_rooms'),
         help_url=config.HELP_URL,
         contact_email=config.PUBLIC_SUPPORT_EMAIL,
         has_tos=bool(tos_url or tos_html),
         tos_html=tos_html,
         has_privacy_policy=bool(privacy_policy_url or privacy_policy_html),
         privacy_policy_html=privacy_policy_html)
Пример #4
0
 def sprite_position(self):
     from indico.modules.rb import rb_cache
     sprite_mapping = rb_cache.get('rooms-sprite-mapping')
     return sprite_mapping.get(self.id, 0) if sprite_mapping else 0  # placeholder at position 0