change return getId
This commit is contained in:
parent
bca529f3c3
commit
dded126926
@ -74,8 +74,8 @@ class WPMenu:
|
||||
except Exception as err:
|
||||
self._logger.error("{0} : Exception error for get url {1} : {2}".format(self._name, canalblog, err))
|
||||
|
||||
def _getId(self, title, parent):
|
||||
menu = {"id":"", "type":"", "title": "", "parent":"", "children": []}
|
||||
def _getId(self, title):
|
||||
idMenu = 0
|
||||
exist = False
|
||||
for i in ["categories", "tags"]:
|
||||
if exist is False:
|
||||
@ -85,7 +85,7 @@ class WPMenu:
|
||||
if page.status_code == 200:
|
||||
result = page.json()
|
||||
if len(result) > 0:
|
||||
menu = {"id":result[0]["id"], "type":i, "title": title, "parent":parent, "children": []}
|
||||
idMenu = result[0]["id"]
|
||||
exist = True
|
||||
else:
|
||||
self._logger.error("{0} : {2} didn't get due status code : {1}".format(self._name, page.status_code, i))
|
||||
@ -95,7 +95,7 @@ class WPMenu:
|
||||
exit(1)
|
||||
except Exception as err:
|
||||
self._logger.error("{0} : Exception error for get url {1} : {2}".format(self._name, "{2}://{0}/wp-json/wp/v2/{1}".format(self._wordpress, i, self._protocol_wordpress), err))
|
||||
return menu
|
||||
return idMenu
|
||||
|
||||
def _menu(self, content):
|
||||
|
||||
@ -132,5 +132,6 @@ class WPMenu:
|
||||
if menu[j]["title"] == children[i]["parent"]:
|
||||
menu[j]["children"].append({"id":"", "title":children[i]["title"], "parent": children[i]["parent"]})
|
||||
|
||||
for i in menu:
|
||||
self._logger.info("{0} : Menu {1} {2}".format(self._name, i["title"], len(i["children"])))
|
||||
for i in range(0, len(menu)):
|
||||
self._logger.info("{0} : Menu {1} {2}".format(self._name, menu[i]["title"], len(menu[i]["children"])))
|
||||
|
Loading…
x
Reference in New Issue
Block a user