Fix bug when no module configuration is present

This commit is contained in:
nemunaire 2014-05-27 16:06:47 +02:00
parent f8dbb7d2e1
commit f97bd593af
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ nemubotversion = 3.3
def load(context):
from hooks import Hook
if not CONF.hasNode("whoisxmlapi") or not CONF.getNode("whoisxmlapi").hasAttribute("username") or not CONF.getNode("whoisxmlapi").hasAttribute("password"):
if not CONF or not CONF.hasNode("whoisxmlapi") or not CONF.getNode("whoisxmlapi").hasAttribute("username") or not CONF.getNode("whoisxmlapi").hasAttribute("password"):
print ("You need a WhoisXML API account in order to use the "
"!netwhois feature. Add it to the module configuration file:\n"
"<whoisxmlapi username=\"XX\" password=\"XXX\" />\nRegister at "

View File

@ -12,7 +12,7 @@ def load(context):
global DATAS
DATAS.setIndex("name", "city")
if not CONF.hasNode("darkskyapi") or not CONF.getNode("darkskyapi").hasAttribute("key"):
if not CONF or not CONF.hasNode("darkskyapi") or not CONF.getNode("darkskyapi").hasAttribute("key"):
print ("You need a Dark-Sky API key in order to use this "
"module. Add it to the module configuration file:\n<darkskyapi"
" key=\"XXXXXXXXXXXXXXXX\" />\nRegister at "