From nobody Sat Apr 20 05:12:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1491260273121679.9703988799714; Mon, 3 Apr 2017 15:57:53 -0700 (PDT) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id E55EE820520; Mon, 3 Apr 2017 22:57:51 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 7DACB8204D7 for ; Mon, 3 Apr 2017 22:57:38 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v33MsmlX071105 for ; Mon, 3 Apr 2017 18:57:37 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 29kubnj0es-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 03 Apr 2017 18:57:37 -0400 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Apr 2017 19:57:35 -0300 Received: from d24relay04.br.ibm.com (9.18.232.146) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 3 Apr 2017 19:57:33 -0300 Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v33MvXdj36372510 for ; Mon, 3 Apr 2017 19:57:33 -0300 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v33MvYLd004731 for ; Mon, 3 Apr 2017 19:57:34 -0300 Received: from alinefm-TP440.ibmmodules.com ([9.85.153.233]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v33MvW1a004716 for ; Mon, 3 Apr 2017 19:57:33 -0300 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 3 Apr 2017 19:57:25 -0300 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17040322-0020-0000-0000-0000029C6142 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17040322-0021-0000-0000-000030B963C8 Message-Id: <20170403225725.1393-1-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-03_20:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=9 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704030202 Subject: [Kimchi-devel] [PATCH] [Wok] Bug fix #1109: Specify Content-Type for SVG files X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some systems do not have mimetype specified for SVG files which prevents SVG files to be loaded on Wok UI. Fix that and also set UIConfig for all plugins to share the same configuration. Signed-off-by: Aline Manera Reviewed-by: Daniel Barboza --- src/wok/config.py.in | 41 +++++++++++++++++++++++++++-------------- tests/test_config.py.in | 1 + 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/wok/config.py.in b/src/wok/config.py.in index c2bcc28..9fd39d9 100644 --- a/src/wok/config.py.in +++ b/src/wok/config.py.in @@ -159,7 +159,7 @@ class PluginPaths(Paths): class UIConfig(dict): def __init__(self, paths): ui_configs =3D {} - for sub_dir in ('css', 'js', 'libs', 'images'): + for sub_dir in ('css', 'js', 'images'): ui_configs['/' + sub_dir] =3D { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(paths.ui_dir, sub_dir), @@ -169,17 +169,10 @@ class UIConfig(dict): ui_configs['/' + sub_dir].update({ 'tools.expires.on': True, 'tools.expires.secs': CACHEEXPIRES}) - - for font, files in FONT_FILES.iteritems(): - font_dir =3D getattr(paths, "%s_dir" % font) - for filename in files: - font_file =3D os.path.join(font_dir, filename) - if os.path.exists(font_file): - ui_configs['/fonts/%s' % filename] =3D { - 'tools.staticfile.on': True, - 'tools.staticfile.filename': font_file, - 'tools.wokauth.on': False, - 'tools.nocache.on': False} + else: + ui_configs['/' + sub_dir].update( + {'tools.staticdir.content_types': + {'svg': 'image/svg+xml'}}) =20 self.update(ui_configs) =20 @@ -237,8 +230,27 @@ class WokConfig(dict): 'tools.staticdir.dir': os.path.join(paths.ui_dir, 'pages/help') }, + '/libs': { + 'tools.staticdir.on': True, + 'tools.staticdir.dir': os.path.join(paths.ui_dir, 'libs'), + 'tools.wokauth.on': False, + 'tools.nocache.on': False, + 'tools.expires.on': True, + 'tools.expires.secs': CACHEEXPIRES + } } =20 + for font, files in FONT_FILES.iteritems(): + font_dir =3D getattr(paths, "%s_dir" % font) + for filename in files: + font_file =3D os.path.join(font_dir, filename) + if os.path.exists(font_file): + wok_config['/fonts/%s' % filename] =3D { + 'tools.staticfile.on': True, + 'tools.staticfile.filename': font_file, + 'tools.wokauth.on': False, + 'tools.nocache.on': False} + def __init__(self): super(WokConfig, self).__init__(self) self.update(self.wok_config) @@ -248,6 +260,7 @@ class WokConfig(dict): class PluginConfig(dict): def __init__(self, plugin_name): super(PluginConfig, self).__init__(self) + paths =3D PluginPaths(plugin_name) plugin_config =3D { '/': { 'tools.trailing_slash.on': False, @@ -264,10 +277,10 @@ class PluginConfig(dict): '/ui/config/tab-ext.xml': { 'tools.staticfile.on': True, 'tools.staticfile.filename': - os.path.join(PluginPaths(plugin_name).ui_dir, - 'config/tab-ext.xml'), + os.path.join(paths.ui_dir, 'config/tab-ext.xml'), 'tools.nocache.on': True}} self.update(plugin_config) + self.update(UIConfig(paths)) =20 =20 def _get_config(): diff --git a/tests/test_config.py.in b/tests/test_config.py.in index a4d65bb..31dd1b8 100644 --- a/tests/test_config.py.in +++ b/tests/test_config.py.in @@ -147,6 +147,7 @@ class ConfigTests(unittest.TestCase): 'tools.wokauth.on': False, 'tools.nocache.on': False, 'tools.staticdir.dir': '%s/ui/images' % paths.prefix, + 'tools.staticdir.content_types': {'svg': 'image/svg+xml'}, 'tools.staticdir.on': True }, '/fonts/fontawesome-webfont.ttf': { --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel