mirror of https://gitlab.com/bashrc2/epicyon
Separate module for minimal button
parent
bf20e507cd
commit
d1426a2afd
|
@ -139,8 +139,8 @@ from blog import htmlBlogView
|
||||||
from blog import htmlBlogPage
|
from blog import htmlBlogPage
|
||||||
from blog import htmlBlogPost
|
from blog import htmlBlogPost
|
||||||
from blog import htmlEditBlog
|
from blog import htmlEditBlog
|
||||||
from webapp_utils import setMinimal
|
from webapp_minimalbutton import setMinimal
|
||||||
from webapp_utils import isMinimal
|
from webapp_minimalbutton import isMinimal
|
||||||
from webapp_utils import getAvatarImageUrl
|
from webapp_utils import getAvatarImageUrl
|
||||||
from webapp_utils import htmlHashtagBlocked
|
from webapp_utils import htmlHashtagBlocked
|
||||||
from webapp_utils import htmlFollowingList
|
from webapp_utils import htmlFollowingList
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
__filename__ = "webapp_minimalbutton.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.2.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@freedombone.net"
|
||||||
|
__status__ = "Production"
|
||||||
|
__module_group__ = "Web Interface"
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def isMinimal(baseDir: str, domain: str, nickname: str) -> bool:
|
||||||
|
"""Returns true if minimal buttons should be shown
|
||||||
|
for the given account
|
||||||
|
"""
|
||||||
|
accountDir = baseDir + '/accounts/' + \
|
||||||
|
nickname + '@' + domain
|
||||||
|
if not os.path.isdir(accountDir):
|
||||||
|
return True
|
||||||
|
minimalFilename = accountDir + '/.notminimal'
|
||||||
|
if os.path.isfile(minimalFilename):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def setMinimal(baseDir: str, domain: str, nickname: str,
|
||||||
|
minimal: bool) -> None:
|
||||||
|
"""Sets whether an account should display minimal buttons
|
||||||
|
"""
|
||||||
|
accountDir = baseDir + '/accounts/' + nickname + '@' + domain
|
||||||
|
if not os.path.isdir(accountDir):
|
||||||
|
return
|
||||||
|
minimalFilename = accountDir + '/.notminimal'
|
||||||
|
minimalFileExists = os.path.isfile(minimalFilename)
|
||||||
|
if minimal and minimalFileExists:
|
||||||
|
os.remove(minimalFilename)
|
||||||
|
elif not minimal and not minimalFileExists:
|
||||||
|
with open(minimalFilename, 'w+') as fp:
|
||||||
|
fp.write('\n')
|
|
@ -1171,33 +1171,3 @@ def htmlKeyboardNavigation(banner: str, links: {}, accessKeys: {},
|
||||||
str(title) + '</a></label></li>\n'
|
str(title) + '</a></label></li>\n'
|
||||||
htmlStr += '</ul></div>\n'
|
htmlStr += '</ul></div>\n'
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
||||||
def isMinimal(baseDir: str, domain: str, nickname: str) -> bool:
|
|
||||||
"""Returns true if minimal buttons should be shown
|
|
||||||
for the given account
|
|
||||||
"""
|
|
||||||
accountDir = baseDir + '/accounts/' + \
|
|
||||||
nickname + '@' + domain
|
|
||||||
if not os.path.isdir(accountDir):
|
|
||||||
return True
|
|
||||||
minimalFilename = accountDir + '/.notminimal'
|
|
||||||
if os.path.isfile(minimalFilename):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def setMinimal(baseDir: str, domain: str, nickname: str,
|
|
||||||
minimal: bool) -> None:
|
|
||||||
"""Sets whether an account should display minimal buttons
|
|
||||||
"""
|
|
||||||
accountDir = baseDir + '/accounts/' + nickname + '@' + domain
|
|
||||||
if not os.path.isdir(accountDir):
|
|
||||||
return
|
|
||||||
minimalFilename = accountDir + '/.notminimal'
|
|
||||||
minimalFileExists = os.path.isfile(minimalFilename)
|
|
||||||
if minimal and minimalFileExists:
|
|
||||||
os.remove(minimalFilename)
|
|
||||||
elif not minimal and not minimalFileExists:
|
|
||||||
with open(minimalFilename, 'w+') as fp:
|
|
||||||
fp.write('\n')
|
|
||||||
|
|
Loading…
Reference in New Issue