forked from indymedia/epicyon
Tidying
parent
d91efacf4b
commit
1aa4559f8b
28
posts.py
28
posts.py
|
@ -1892,6 +1892,22 @@ def isReply(postJsonObject: {},actor: str) -> bool:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def createBoxIndex(boxDir: str,postsInBoxDict: {}) -> int:
|
||||||
|
""" Creates an index for the given box
|
||||||
|
"""
|
||||||
|
postsCtr=0
|
||||||
|
postsInPersonInbox=os.scandir(boxDir)
|
||||||
|
for postFilename in postsInPersonInbox:
|
||||||
|
postFilename=postFilename.name
|
||||||
|
if not postFilename.endswith('.json'):
|
||||||
|
continue
|
||||||
|
# extract the status number
|
||||||
|
statusNumber=getStatusNumberFromPostFilename(postFilename)
|
||||||
|
if statusNumber:
|
||||||
|
postsInBoxDict[statusNumber]=os.path.join(boxDir, postFilename)
|
||||||
|
postsCtr+=1
|
||||||
|
return postsCtr
|
||||||
|
|
||||||
def createBoxBase(session,baseDir: str,boxname: str, \
|
def createBoxBase(session,baseDir: str,boxname: str, \
|
||||||
nickname: str,domain: str,port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
itemsPerPage: int,headerOnly: bool,authorized :bool, \
|
itemsPerPage: int,headerOnly: bool,authorized :bool, \
|
||||||
|
@ -1941,17 +1957,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \
|
||||||
|
|
||||||
# post filenames sorted in descending order
|
# post filenames sorted in descending order
|
||||||
postsInBoxDict={}
|
postsInBoxDict={}
|
||||||
postsCtr=0
|
postsCtr=createBoxIndex(boxDir,postsInBoxDict)
|
||||||
postsInPersonInbox=os.scandir(boxDir)
|
|
||||||
for postFilename in postsInPersonInbox:
|
|
||||||
postFilename=postFilename.name
|
|
||||||
if not postFilename.endswith('.json'):
|
|
||||||
continue
|
|
||||||
# extract the status number
|
|
||||||
statusNumber=getStatusNumberFromPostFilename(postFilename)
|
|
||||||
if statusNumber:
|
|
||||||
postsInBoxDict[statusNumber]=os.path.join(boxDir, postFilename)
|
|
||||||
postsCtr+=1
|
|
||||||
|
|
||||||
# combine the inbox for the account with the shared inbox
|
# combine the inbox for the account with the shared inbox
|
||||||
if sharedBoxDir:
|
if sharedBoxDir:
|
||||||
|
|
Loading…
Reference in New Issue