diff --git a/blog.py b/blog.py index 41882116..3216f9b8 100644 --- a/blog.py +++ b/blog.py @@ -622,6 +622,7 @@ def getBlogIndexesForAccounts(baseDir: str) -> {}: blogsIndex = accountDir + '/tlblogs.index' if os.path.isfile(blogsIndex): blogIndexes[acct] = blogsIndex + break return blogIndexes @@ -639,6 +640,7 @@ def noOfBlogAccounts(baseDir: str) -> int: blogsIndex = accountDir + '/tlblogs.index' if os.path.isfile(blogsIndex): ctr += 1 + break return ctr @@ -655,6 +657,7 @@ def singleBlogAccountNickname(baseDir: str) -> str: blogsIndex = accountDir + '/tlblogs.index' if os.path.isfile(blogsIndex): return acct.split('@')[0] + break return None @@ -698,6 +701,7 @@ def htmlBlogView(authorized: bool, httpPrefix + '://' + domainFull + '/blog/' + \ acct.split('@')[0] + '">' + acct + '' blogStr += '

' + break return blogStr + htmlFooter() diff --git a/daemon.py b/daemon.py index 0465c469..cb8add17 100644 --- a/daemon.py +++ b/daemon.py @@ -4789,6 +4789,7 @@ class PubServer(BaseHTTPRequestHandler): port, maxPostsInRSSFeed, 1, False) + break if msg: msg = rss2Header(httpPrefix, 'news', domainFull, @@ -12133,6 +12134,7 @@ class PubServer(BaseHTTPRequestHandler): contentJson = loadJson(deviceFilename) if contentJson: devicesList.append(contentJson) + break # return the list of devices for this handle msg = \ json.dumps(devicesList, @@ -12932,6 +12934,7 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None: continue tokensDict[nickname] = token tokensLookup[token] = nickname + break def runDaemon(dormantMonths: int, diff --git a/delete.py b/delete.py index 3b195db7..58dbd5d2 100644 --- a/delete.py +++ b/delete.py @@ -321,6 +321,7 @@ def removeOldHashtags(baseDir: str, maxMonths: int) -> str: # check of the file is too old if fileDaysSinceEpoch < maxDaysSinceEpoch: removeHashtags.append(tagsFilename) + break for removeFilename in removeHashtags: try: diff --git a/devices.py b/devices.py index 69c8d2ca..3f0ef52b 100644 --- a/devices.py +++ b/devices.py @@ -152,6 +152,7 @@ def E2EEdevicesCollection(baseDir: str, nickname: str, domain: str, devJson = loadJson(deviceFilename) if devJson: deviceList.append(devJson) + break devicesDict = { 'id': personId + '/collections/devices', diff --git a/follow.py b/follow.py index 53349f05..a8b2bd89 100644 --- a/follow.py +++ b/follow.py @@ -1203,6 +1203,7 @@ def getFollowersOfActor(baseDir: str, actor: str, debug: bool) -> {}: print('DEBUG: ' + account + ' follows ' + actorHandle) recipientsDict[account] = None + break return recipientsDict diff --git a/inbox.py b/inbox.py index 0489aff7..4772a763 100644 --- a/inbox.py +++ b/inbox.py @@ -200,6 +200,7 @@ def validInbox(baseDir: str, nickname: str, domain: str) -> bool: if 'postNickname' in open(filename).read(): print('queue file incorrectly saved to ' + filename) return False + break return True @@ -224,6 +225,7 @@ def validInboxFilenames(baseDir: str, nickname: str, domain: str, print('Expected: ' + expectedStr) print('Invalid filename: ' + filename) return False + break return True @@ -2471,6 +2473,7 @@ def clearQueueItems(baseDir: str, queue: []) -> None: ctr += 1 except BaseException: pass + break if ctr > 0: 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 qfile in queuefiles: queue.append(os.path.join(queueDir, qfile)) + break if len(queue) > 0: print('Restored ' + str(len(queue)) + ' inbox queue items') diff --git a/media.py b/media.py index 2163820d..df6409f7 100644 --- a/media.py +++ b/media.py @@ -221,3 +221,4 @@ def archiveMedia(baseDir: str, archiveDirectory: str, maxWeeks=4) -> None: else: # archive to /dev/null rmtree(os.path.join(baseDir + '/media', weekDir)) + break diff --git a/migrate.py b/migrate.py index 6fb8bee2..4b04d852 100644 --- a/migrate.py +++ b/migrate.py @@ -51,3 +51,4 @@ def migrateAccount(baseDir: str, oldHandle: str, newHandle: str) -> None: migrateFollows(followFilename, oldHandle, newHandle) followFilename = accountDir + '/followers.txt' migrateFollows(followFilename, oldHandle, newHandle) + break diff --git a/newswire.py b/newswire.py index 144e7854..a71ee2bf 100644 --- a/newswire.py +++ b/newswire.py @@ -760,6 +760,7 @@ def addBlogsToNewswire(baseDir: str, domain: str, newswire: {}, addAccountBlogsToNewswire(baseDir, nickname, domain, newswire, maxBlogsPerAccount, blogsIndex, maxTags) + break # sort the moderation dict into chronological order, latest first sortedModerationDict = \ diff --git a/posts.py b/posts.py index b5c3cd3b..b35c0505 100644 --- a/posts.py +++ b/posts.py @@ -3195,6 +3195,7 @@ def archivePosts(baseDir: str, httpPrefix: str, archiveDir: str, archivePostsForPerson(httpPrefix, nickname, domain, baseDir, 'outbox', archiveSubdir, recentPostsCache, maxPostsInBox) + break def archivePostsForPerson(httpPrefix: str, nickname: str, domain: str, diff --git a/schedule.py b/schedule.py index 919ab2b7..c213c4ec 100644 --- a/schedule.py +++ b/schedule.py @@ -146,6 +146,7 @@ def runPostSchedule(baseDir: str, httpd, maxScheduledPosts: int): if not os.path.isfile(scheduleIndexFilename): continue updatePostSchedule(baseDir, account, httpd, maxScheduledPosts) + break def runPostScheduleWatchdog(projectVersion: str, httpd) -> None: diff --git a/shares.py b/shares.py index 9c9cba29..d4b19b36 100644 --- a/shares.py +++ b/shares.py @@ -167,6 +167,7 @@ def addShare(baseDir: str, '/users/' + nickname + '/tlshares') except BaseException: pass + break def expireShares(baseDir: str) -> None: @@ -179,6 +180,7 @@ def expireShares(baseDir: str) -> None: nickname = account.split('@')[0] domain = account.split('@')[1] expireSharesForAccount(baseDir, nickname, domain) + break def expireSharesForAccount(baseDir: str, nickname: str, domain: str) -> None: diff --git a/theme.py b/theme.py index 4f85a9d5..bc34fe1c 100644 --- a/theme.py +++ b/theme.py @@ -557,6 +557,7 @@ def setThemeImages(baseDir: str, name: str) -> None: os.remove(accountDir + '/right_col_image.png') except BaseException: pass + break def setNewsAvatar(baseDir: str, name: str, diff --git a/utils.py b/utils.py index 84c001a2..4fd05450 100644 --- a/utils.py +++ b/utils.py @@ -110,6 +110,7 @@ def getHashtagCategories(baseDir: str, recent=False, category=None) -> None: else: if hashtag not in hashtagCategories[categoryStr]: hashtagCategories[categoryStr].append(hashtag) + break return hashtagCategories @@ -407,6 +408,7 @@ def getFollowersOfPerson(baseDir: str, if account not in followers: followers.append(account) break + break return followers @@ -932,6 +934,7 @@ def clearFromPostCaches(baseDir: str, recentPostsCache: {}, if recentPostsCache.get('html'): if recentPostsCache['html'].get(postId): del recentPostsCache['html'][postId] + break def locatePost(baseDir: str, nickname: str, domain: str, @@ -1195,6 +1198,7 @@ def noOfAccounts(baseDir: str) -> bool: if '@' in account: if not account.startswith('inbox@'): accountCtr += 1 + break return accountCtr @@ -1217,6 +1221,7 @@ def noOfActiveAccountsMonthly(baseDir: str, months: int) -> bool: timeDiff = (currTime - int(lastUsed)) if timeDiff < monthSeconds: accountCtr += 1 + break return accountCtr @@ -1493,6 +1498,7 @@ def searchBoxPosts(baseDir: str, nickname: str, domain: str, res.append(filePath) if len(res) >= maxResults: return res + break return res diff --git a/webapp_hashtagswarm.py b/webapp_hashtagswarm.py index 37e51060..3dd92f54 100644 --- a/webapp_hashtagswarm.py +++ b/webapp_hashtagswarm.py @@ -197,6 +197,7 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str: if categoryStr not in categorySwarm: categorySwarm.append(categoryStr) break + break if not tagSwarm: return '' diff --git a/webapp_search.py b/webapp_search.py index 378fa653..13d8ea87 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -256,6 +256,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, sharedItemsForm += '\n' break ctr = 0 + break if not resultsExist: sharedItemsForm += \ '
' + translate['No results'] + '
\n' @@ -428,6 +429,7 @@ def htmlSkillsSearch(actor: str, ';' + actorJson['icon']['url'] if indexStr not in results: results.append(indexStr) + break if not instanceOnly: # search actor cache for subdir, dirs, files in os.walk(baseDir + '/cache/actors/'): @@ -465,6 +467,7 @@ def htmlSkillsSearch(actor: str, ';' + actorJson['icon']['url'] if indexStr not in results: results.append(indexStr) + break results.sort(reverse=True) diff --git a/webapp_utils.py b/webapp_utils.py index ce54a0f4..f70d7603 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -429,6 +429,7 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int, ctr += 1 if ctr >= maxSharesPerAccount: break + break # sort the shared items in descending order of publication date sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True)) lastPage = False