forked from indymedia/epicyon
Break after loop
parent
12cccfdeb6
commit
e87fd5a168
4
blog.py
4
blog.py
|
@ -622,6 +622,7 @@ def getBlogIndexesForAccounts(baseDir: str) -> {}:
|
||||||
blogsIndex = accountDir + '/tlblogs.index'
|
blogsIndex = accountDir + '/tlblogs.index'
|
||||||
if os.path.isfile(blogsIndex):
|
if os.path.isfile(blogsIndex):
|
||||||
blogIndexes[acct] = blogsIndex
|
blogIndexes[acct] = blogsIndex
|
||||||
|
break
|
||||||
return blogIndexes
|
return blogIndexes
|
||||||
|
|
||||||
|
|
||||||
|
@ -639,6 +640,7 @@ def noOfBlogAccounts(baseDir: str) -> int:
|
||||||
blogsIndex = accountDir + '/tlblogs.index'
|
blogsIndex = accountDir + '/tlblogs.index'
|
||||||
if os.path.isfile(blogsIndex):
|
if os.path.isfile(blogsIndex):
|
||||||
ctr += 1
|
ctr += 1
|
||||||
|
break
|
||||||
return ctr
|
return ctr
|
||||||
|
|
||||||
|
|
||||||
|
@ -655,6 +657,7 @@ def singleBlogAccountNickname(baseDir: str) -> str:
|
||||||
blogsIndex = accountDir + '/tlblogs.index'
|
blogsIndex = accountDir + '/tlblogs.index'
|
||||||
if os.path.isfile(blogsIndex):
|
if os.path.isfile(blogsIndex):
|
||||||
return acct.split('@')[0]
|
return acct.split('@')[0]
|
||||||
|
break
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -698,6 +701,7 @@ def htmlBlogView(authorized: bool,
|
||||||
httpPrefix + '://' + domainFull + '/blog/' + \
|
httpPrefix + '://' + domainFull + '/blog/' + \
|
||||||
acct.split('@')[0] + '">' + acct + '</a>'
|
acct.split('@')[0] + '">' + acct + '</a>'
|
||||||
blogStr += '</p>'
|
blogStr += '</p>'
|
||||||
|
break
|
||||||
|
|
||||||
return blogStr + htmlFooter()
|
return blogStr + htmlFooter()
|
||||||
|
|
||||||
|
|
|
@ -4789,6 +4789,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
port,
|
port,
|
||||||
maxPostsInRSSFeed, 1,
|
maxPostsInRSSFeed, 1,
|
||||||
False)
|
False)
|
||||||
|
break
|
||||||
if msg:
|
if msg:
|
||||||
msg = rss2Header(httpPrefix,
|
msg = rss2Header(httpPrefix,
|
||||||
'news', domainFull,
|
'news', domainFull,
|
||||||
|
@ -12133,6 +12134,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
contentJson = loadJson(deviceFilename)
|
contentJson = loadJson(deviceFilename)
|
||||||
if contentJson:
|
if contentJson:
|
||||||
devicesList.append(contentJson)
|
devicesList.append(contentJson)
|
||||||
|
break
|
||||||
# return the list of devices for this handle
|
# return the list of devices for this handle
|
||||||
msg = \
|
msg = \
|
||||||
json.dumps(devicesList,
|
json.dumps(devicesList,
|
||||||
|
@ -12932,6 +12934,7 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None:
|
||||||
continue
|
continue
|
||||||
tokensDict[nickname] = token
|
tokensDict[nickname] = token
|
||||||
tokensLookup[token] = nickname
|
tokensLookup[token] = nickname
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def runDaemon(dormantMonths: int,
|
def runDaemon(dormantMonths: int,
|
||||||
|
|
|
@ -321,6 +321,7 @@ def removeOldHashtags(baseDir: str, maxMonths: int) -> str:
|
||||||
# check of the file is too old
|
# check of the file is too old
|
||||||
if fileDaysSinceEpoch < maxDaysSinceEpoch:
|
if fileDaysSinceEpoch < maxDaysSinceEpoch:
|
||||||
removeHashtags.append(tagsFilename)
|
removeHashtags.append(tagsFilename)
|
||||||
|
break
|
||||||
|
|
||||||
for removeFilename in removeHashtags:
|
for removeFilename in removeHashtags:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -152,6 +152,7 @@ def E2EEdevicesCollection(baseDir: str, nickname: str, domain: str,
|
||||||
devJson = loadJson(deviceFilename)
|
devJson = loadJson(deviceFilename)
|
||||||
if devJson:
|
if devJson:
|
||||||
deviceList.append(devJson)
|
deviceList.append(devJson)
|
||||||
|
break
|
||||||
|
|
||||||
devicesDict = {
|
devicesDict = {
|
||||||
'id': personId + '/collections/devices',
|
'id': personId + '/collections/devices',
|
||||||
|
|
|
@ -1203,6 +1203,7 @@ def getFollowersOfActor(baseDir: str, actor: str, debug: bool) -> {}:
|
||||||
print('DEBUG: ' + account +
|
print('DEBUG: ' + account +
|
||||||
' follows ' + actorHandle)
|
' follows ' + actorHandle)
|
||||||
recipientsDict[account] = None
|
recipientsDict[account] = None
|
||||||
|
break
|
||||||
return recipientsDict
|
return recipientsDict
|
||||||
|
|
||||||
|
|
||||||
|
|
4
inbox.py
4
inbox.py
|
@ -200,6 +200,7 @@ def validInbox(baseDir: str, nickname: str, domain: str) -> bool:
|
||||||
if 'postNickname' in open(filename).read():
|
if 'postNickname' in open(filename).read():
|
||||||
print('queue file incorrectly saved to ' + filename)
|
print('queue file incorrectly saved to ' + filename)
|
||||||
return False
|
return False
|
||||||
|
break
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,6 +225,7 @@ def validInboxFilenames(baseDir: str, nickname: str, domain: str,
|
||||||
print('Expected: ' + expectedStr)
|
print('Expected: ' + expectedStr)
|
||||||
print('Invalid filename: ' + filename)
|
print('Invalid filename: ' + filename)
|
||||||
return False
|
return False
|
||||||
|
break
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -2471,6 +2473,7 @@ def clearQueueItems(baseDir: str, queue: []) -> None:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
break
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
print('Removed ' + str(ctr) + ' inbox queue items')
|
print('Removed ' + str(ctr) + ' inbox queue items')
|
||||||
|
|
||||||
|
@ -2487,6 +2490,7 @@ def restoreQueueItems(baseDir: str, queue: []) -> None:
|
||||||
for queuesubdir, queuedirs, queuefiles in os.walk(queueDir):
|
for queuesubdir, queuedirs, queuefiles in os.walk(queueDir):
|
||||||
for qfile in queuefiles:
|
for qfile in queuefiles:
|
||||||
queue.append(os.path.join(queueDir, qfile))
|
queue.append(os.path.join(queueDir, qfile))
|
||||||
|
break
|
||||||
if len(queue) > 0:
|
if len(queue) > 0:
|
||||||
print('Restored ' + str(len(queue)) + ' inbox queue items')
|
print('Restored ' + str(len(queue)) + ' inbox queue items')
|
||||||
|
|
||||||
|
|
1
media.py
1
media.py
|
@ -221,3 +221,4 @@ def archiveMedia(baseDir: str, archiveDirectory: str, maxWeeks=4) -> None:
|
||||||
else:
|
else:
|
||||||
# archive to /dev/null
|
# archive to /dev/null
|
||||||
rmtree(os.path.join(baseDir + '/media', weekDir))
|
rmtree(os.path.join(baseDir + '/media', weekDir))
|
||||||
|
break
|
||||||
|
|
|
@ -51,3 +51,4 @@ def migrateAccount(baseDir: str, oldHandle: str, newHandle: str) -> None:
|
||||||
migrateFollows(followFilename, oldHandle, newHandle)
|
migrateFollows(followFilename, oldHandle, newHandle)
|
||||||
followFilename = accountDir + '/followers.txt'
|
followFilename = accountDir + '/followers.txt'
|
||||||
migrateFollows(followFilename, oldHandle, newHandle)
|
migrateFollows(followFilename, oldHandle, newHandle)
|
||||||
|
break
|
||||||
|
|
|
@ -760,6 +760,7 @@ def addBlogsToNewswire(baseDir: str, domain: str, newswire: {},
|
||||||
addAccountBlogsToNewswire(baseDir, nickname, domain,
|
addAccountBlogsToNewswire(baseDir, nickname, domain,
|
||||||
newswire, maxBlogsPerAccount,
|
newswire, maxBlogsPerAccount,
|
||||||
blogsIndex, maxTags)
|
blogsIndex, maxTags)
|
||||||
|
break
|
||||||
|
|
||||||
# sort the moderation dict into chronological order, latest first
|
# sort the moderation dict into chronological order, latest first
|
||||||
sortedModerationDict = \
|
sortedModerationDict = \
|
||||||
|
|
1
posts.py
1
posts.py
|
@ -3195,6 +3195,7 @@ def archivePosts(baseDir: str, httpPrefix: str, archiveDir: str,
|
||||||
archivePostsForPerson(httpPrefix, nickname, domain, baseDir,
|
archivePostsForPerson(httpPrefix, nickname, domain, baseDir,
|
||||||
'outbox', archiveSubdir,
|
'outbox', archiveSubdir,
|
||||||
recentPostsCache, maxPostsInBox)
|
recentPostsCache, maxPostsInBox)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def archivePostsForPerson(httpPrefix: str, nickname: str, domain: str,
|
def archivePostsForPerson(httpPrefix: str, nickname: str, domain: str,
|
||||||
|
|
|
@ -146,6 +146,7 @@ def runPostSchedule(baseDir: str, httpd, maxScheduledPosts: int):
|
||||||
if not os.path.isfile(scheduleIndexFilename):
|
if not os.path.isfile(scheduleIndexFilename):
|
||||||
continue
|
continue
|
||||||
updatePostSchedule(baseDir, account, httpd, maxScheduledPosts)
|
updatePostSchedule(baseDir, account, httpd, maxScheduledPosts)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def runPostScheduleWatchdog(projectVersion: str, httpd) -> None:
|
def runPostScheduleWatchdog(projectVersion: str, httpd) -> None:
|
||||||
|
|
|
@ -167,6 +167,7 @@ def addShare(baseDir: str,
|
||||||
'/users/' + nickname + '/tlshares')
|
'/users/' + nickname + '/tlshares')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def expireShares(baseDir: str) -> None:
|
def expireShares(baseDir: str) -> None:
|
||||||
|
@ -179,6 +180,7 @@ def expireShares(baseDir: str) -> None:
|
||||||
nickname = account.split('@')[0]
|
nickname = account.split('@')[0]
|
||||||
domain = account.split('@')[1]
|
domain = account.split('@')[1]
|
||||||
expireSharesForAccount(baseDir, nickname, domain)
|
expireSharesForAccount(baseDir, nickname, domain)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def expireSharesForAccount(baseDir: str, nickname: str, domain: str) -> None:
|
def expireSharesForAccount(baseDir: str, nickname: str, domain: str) -> None:
|
||||||
|
|
1
theme.py
1
theme.py
|
@ -557,6 +557,7 @@ def setThemeImages(baseDir: str, name: str) -> None:
|
||||||
os.remove(accountDir + '/right_col_image.png')
|
os.remove(accountDir + '/right_col_image.png')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def setNewsAvatar(baseDir: str, name: str,
|
def setNewsAvatar(baseDir: str, name: str,
|
||||||
|
|
6
utils.py
6
utils.py
|
@ -110,6 +110,7 @@ def getHashtagCategories(baseDir: str, recent=False, category=None) -> None:
|
||||||
else:
|
else:
|
||||||
if hashtag not in hashtagCategories[categoryStr]:
|
if hashtag not in hashtagCategories[categoryStr]:
|
||||||
hashtagCategories[categoryStr].append(hashtag)
|
hashtagCategories[categoryStr].append(hashtag)
|
||||||
|
break
|
||||||
return hashtagCategories
|
return hashtagCategories
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,6 +408,7 @@ def getFollowersOfPerson(baseDir: str,
|
||||||
if account not in followers:
|
if account not in followers:
|
||||||
followers.append(account)
|
followers.append(account)
|
||||||
break
|
break
|
||||||
|
break
|
||||||
return followers
|
return followers
|
||||||
|
|
||||||
|
|
||||||
|
@ -932,6 +934,7 @@ def clearFromPostCaches(baseDir: str, recentPostsCache: {},
|
||||||
if recentPostsCache.get('html'):
|
if recentPostsCache.get('html'):
|
||||||
if recentPostsCache['html'].get(postId):
|
if recentPostsCache['html'].get(postId):
|
||||||
del recentPostsCache['html'][postId]
|
del recentPostsCache['html'][postId]
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def locatePost(baseDir: str, nickname: str, domain: str,
|
def locatePost(baseDir: str, nickname: str, domain: str,
|
||||||
|
@ -1195,6 +1198,7 @@ def noOfAccounts(baseDir: str) -> bool:
|
||||||
if '@' in account:
|
if '@' in account:
|
||||||
if not account.startswith('inbox@'):
|
if not account.startswith('inbox@'):
|
||||||
accountCtr += 1
|
accountCtr += 1
|
||||||
|
break
|
||||||
return accountCtr
|
return accountCtr
|
||||||
|
|
||||||
|
|
||||||
|
@ -1217,6 +1221,7 @@ def noOfActiveAccountsMonthly(baseDir: str, months: int) -> bool:
|
||||||
timeDiff = (currTime - int(lastUsed))
|
timeDiff = (currTime - int(lastUsed))
|
||||||
if timeDiff < monthSeconds:
|
if timeDiff < monthSeconds:
|
||||||
accountCtr += 1
|
accountCtr += 1
|
||||||
|
break
|
||||||
return accountCtr
|
return accountCtr
|
||||||
|
|
||||||
|
|
||||||
|
@ -1493,6 +1498,7 @@ def searchBoxPosts(baseDir: str, nickname: str, domain: str,
|
||||||
res.append(filePath)
|
res.append(filePath)
|
||||||
if len(res) >= maxResults:
|
if len(res) >= maxResults:
|
||||||
return res
|
return res
|
||||||
|
break
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
if categoryStr not in categorySwarm:
|
if categoryStr not in categorySwarm:
|
||||||
categorySwarm.append(categoryStr)
|
categorySwarm.append(categoryStr)
|
||||||
break
|
break
|
||||||
|
break
|
||||||
|
|
||||||
if not tagSwarm:
|
if not tagSwarm:
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -256,6 +256,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
||||||
sharedItemsForm += '</form>\n'
|
sharedItemsForm += '</form>\n'
|
||||||
break
|
break
|
||||||
ctr = 0
|
ctr = 0
|
||||||
|
break
|
||||||
if not resultsExist:
|
if not resultsExist:
|
||||||
sharedItemsForm += \
|
sharedItemsForm += \
|
||||||
'<center><h5>' + translate['No results'] + '</h5></center>\n'
|
'<center><h5>' + translate['No results'] + '</h5></center>\n'
|
||||||
|
@ -428,6 +429,7 @@ def htmlSkillsSearch(actor: str,
|
||||||
';' + actorJson['icon']['url']
|
';' + actorJson['icon']['url']
|
||||||
if indexStr not in results:
|
if indexStr not in results:
|
||||||
results.append(indexStr)
|
results.append(indexStr)
|
||||||
|
break
|
||||||
if not instanceOnly:
|
if not instanceOnly:
|
||||||
# search actor cache
|
# search actor cache
|
||||||
for subdir, dirs, files in os.walk(baseDir + '/cache/actors/'):
|
for subdir, dirs, files in os.walk(baseDir + '/cache/actors/'):
|
||||||
|
@ -465,6 +467,7 @@ def htmlSkillsSearch(actor: str,
|
||||||
';' + actorJson['icon']['url']
|
';' + actorJson['icon']['url']
|
||||||
if indexStr not in results:
|
if indexStr not in results:
|
||||||
results.append(indexStr)
|
results.append(indexStr)
|
||||||
|
break
|
||||||
|
|
||||||
results.sort(reverse=True)
|
results.sort(reverse=True)
|
||||||
|
|
||||||
|
|
|
@ -429,6 +429,7 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
|
||||||
ctr += 1
|
ctr += 1
|
||||||
if ctr >= maxSharesPerAccount:
|
if ctr >= maxSharesPerAccount:
|
||||||
break
|
break
|
||||||
|
break
|
||||||
# sort the shared items in descending order of publication date
|
# sort the shared items in descending order of publication date
|
||||||
sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True))
|
sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True))
|
||||||
lastPage = False
|
lastPage = False
|
||||||
|
|
Loading…
Reference in New Issue