parent id 75%
This commit is contained in:
parent
bd8ac241c1
commit
581b6941a6
@ -226,7 +226,6 @@ class WPimport:
|
||||
## Check class name
|
||||
|
||||
def _hasClassName(self, tag, className):
|
||||
print(tag["class"])
|
||||
for i in tag["class"]:
|
||||
if i == className:
|
||||
return True
|
||||
@ -256,24 +255,20 @@ class WPimport:
|
||||
comment_content = comment_content + comment_item[j] + "<br />"
|
||||
comment_content = comment_content + "</p>"
|
||||
parent = -1
|
||||
parent_class = "level-1"
|
||||
print(self._hasClassName(comment[i], parent_class))
|
||||
if self._hasClassName(comment[i], parent_class) is False:
|
||||
if self._hasClassName(comment[i], "level-1") is False:
|
||||
block = False
|
||||
className = self._getClassName(comment[i], "level-").split("-")
|
||||
level = 1
|
||||
if len(className) > 0:
|
||||
level = int(className[1])
|
||||
for j in range(i-1, 0):
|
||||
for j in range(i-1, 0, -1):
|
||||
if block is False:
|
||||
levelName = "level-{0}".format(level - 1)
|
||||
print(levelName)
|
||||
if self._hasClassName(comment[j], levelName):
|
||||
if self._hasClassName(comment[j], levelName) is True:
|
||||
parent = j
|
||||
parent_class = levelName
|
||||
block = True
|
||||
|
||||
comment_post.append({"author": comment_author, "date": comment_date, "content": comment_content, "parent_id":parent, "parent_class": parent_class})
|
||||
comment_post.append({"author": comment_author, "date": comment_date, "content": comment_content, "parent_id":parent})
|
||||
return comment_post
|
||||
## Add or Update post
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user