forked from indymedia/epicyon
Function sequence
parent
30e63970f6
commit
2b15de6ee7
24
utils.py
24
utils.py
|
@ -19,18 +19,6 @@ from calendar import monthrange
|
||||||
from followingCalendar import addPersonToCalendar
|
from followingCalendar import addPersonToCalendar
|
||||||
|
|
||||||
|
|
||||||
def firstParagraphFromString(content: str) -> str:
|
|
||||||
"""Get the first paragraph from a blog post
|
|
||||||
to be used as a summary in the newswire feed
|
|
||||||
"""
|
|
||||||
if '<p>' not in content or '</p>' not in content:
|
|
||||||
return removeHtml(content)
|
|
||||||
paragraph = content.split('<p>')[1]
|
|
||||||
if '</p>' in paragraph:
|
|
||||||
paragraph = paragraph.split('</p>')[0]
|
|
||||||
return removeHtml(paragraph)
|
|
||||||
|
|
||||||
|
|
||||||
def removeHtml(content: str) -> str:
|
def removeHtml(content: str) -> str:
|
||||||
"""Removes html links from the given content.
|
"""Removes html links from the given content.
|
||||||
Used to ensure that profile descriptions don't contain dubious content
|
Used to ensure that profile descriptions don't contain dubious content
|
||||||
|
@ -50,6 +38,18 @@ def removeHtml(content: str) -> str:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def firstParagraphFromString(content: str) -> str:
|
||||||
|
"""Get the first paragraph from a blog post
|
||||||
|
to be used as a summary in the newswire feed
|
||||||
|
"""
|
||||||
|
if '<p>' not in content or '</p>' not in content:
|
||||||
|
return removeHtml(content)
|
||||||
|
paragraph = content.split('<p>')[1]
|
||||||
|
if '</p>' in paragraph:
|
||||||
|
paragraph = paragraph.split('</p>')[0]
|
||||||
|
return removeHtml(paragraph)
|
||||||
|
|
||||||
|
|
||||||
def isSystemAccount(nickname: str) -> bool:
|
def isSystemAccount(nickname: str) -> bool:
|
||||||
"""Returns true if the given nickname is a system account
|
"""Returns true if the given nickname is a system account
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue