parent and children array
This commit is contained in:
parent
5059a15826
commit
bca529f3c3
@ -109,10 +109,7 @@ class WPMenu:
|
|||||||
href = anchor.find("a").get("href")
|
href = anchor.find("a").get("href")
|
||||||
if href == "{0}://{1}/".format(self._protocol_canalblog, self._canalblog):
|
if href == "{0}://{1}/".format(self._protocol_canalblog, self._canalblog):
|
||||||
parent = "home"
|
parent = "home"
|
||||||
itemMenu = {"id":"", "type":"", "title": parent, "children":list()}
|
itemMenu = {"id":"", "type":"", "title": parent, "children":list()}
|
||||||
|
|
||||||
|
|
||||||
#menu = self._child(parent, parent)
|
|
||||||
if href == "#":
|
if href == "#":
|
||||||
li = anchor.find("ul").find_all("li")
|
li = anchor.find("ul").find_all("li")
|
||||||
for child in li:
|
for child in li:
|
||||||
@ -122,13 +119,16 @@ class WPMenu:
|
|||||||
menu.append(itemMenu)
|
menu.append(itemMenu)
|
||||||
|
|
||||||
|
|
||||||
for i in range(0, len(children)-1):
|
for i in range(0, len(children)):
|
||||||
self._logger.info("{0} : Child {1}".format(self._name, children[i]))
|
self._logger.info("{0} : Child {1} {2}".format(self._name, children[i], i))
|
||||||
for j in range(0, len(menu)-1):
|
for j in range(0, len(menu)):
|
||||||
if menu[j]["title"] == children[i]["title"]:
|
if j < len(menu):
|
||||||
self._logger.info("{0} : Parent {1}".format(self._name, menu[j]))
|
if menu[j]["title"] == children[i]["title"]:
|
||||||
del menu[j]
|
self._logger.info("{0} : Parent {1} {2}".format(self._name, menu[j], j))
|
||||||
for j in range(0, len(menu)-1):
|
del menu[j]
|
||||||
|
|
||||||
|
for j in range(0, len(menu)):
|
||||||
|
self._logger.info("{0} : Children for : {1}".format(self._name, menu[j]["title"]))
|
||||||
if menu[j]["title"] == children[i]["parent"]:
|
if menu[j]["title"] == children[i]["parent"]:
|
||||||
menu[j]["children"].append({"id":"", "title":children[i]["title"], "parent": children[i]["parent"]})
|
menu[j]["children"].append({"id":"", "title":children[i]["title"], "parent": children[i]["parent"]})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user