[Kimchi-devel] [kimchi-devel][PATCH 3/7] Close json schema file after loading

Aline Manera alinefm at linux.vnet.ibm.com
Thu Jan 22 17:41:00 UTC 2015


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 20/01/2015 06:45, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
>   src/kimchi/root.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/root.py b/src/kimchi/root.py
> index 6f191eb..eb0ade7 100644
> --- a/src/kimchi/root.py
> +++ b/src/kimchi/root.py
> @@ -120,8 +120,8 @@ class KimchiRoot(Root):
>           self.default_page = 'kimchi-ui.html'
>           for ident, node in sub_nodes.items():
>               setattr(self, ident, node(model))
> -        self.api_schema = json.load(open(os.path.join(paths.src_dir,
> -                                                      'API.json')))
> +        with open(os.path.join(paths.src_dir, 'API.json')) as f:
> +            self.api_schema = json.load(f)
>           self.paths = paths
>           self.domain = 'kimchi'
>           self.messages = messages




More information about the Kimchi-devel mailing list