emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.06k stars 71 forks source link

YAMLLoadWarning #244

Closed josejachuf closed 5 years ago

josejachuf commented 5 years ago

/venv36/lib/python3.6/site-packages/weppy/app.py:154: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. rc = ymlload(rc)

advh67 commented 5 years ago

I have the same problem. I use a fully updated python 3.7.

https://github.com/gi0baro/weppy/blob/master/weppy/app.py

line 151: def config_from_yaml(self, filename, namespace=None): ....

bronte2k7 commented 5 years ago

need override class App: example

import os

from weppy import App as Base
from weppy.utils import dict_to_sdict, read_file
from yaml import load as ymlload
from yaml import SafeLoader as ymlLoader

class App(Base):
    def config_from_yaml(self, filename, namespace=None):
        #: import configuration from yaml files
        rc = read_file(os.path.join(self.config_path, filename))
        rc = ymlload(rc, Loader=ymlLoader)
        c = self.config if namespace is None else self.config[namespace]
        for key, val in rc.items():
            c[key] = dict_to_sdict(val)

and use this class App for your application