flake8 format

main
Bob Mottram 2020-04-05 10:33:23 +01:00
parent 7c7e8242ed
commit 14433d8534
3 changed files with 38 additions and 20 deletions

View File

@ -12,9 +12,6 @@ from utils import locatePost
from utils import evilIncarnate from utils import evilIncarnate
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
from session import postJson
from auth import createBasicAuthHeader
from webfinger import webfingerHandle
def addGlobalBlock(baseDir: str, def addGlobalBlock(baseDir: str,

53
blog.py
View File

@ -586,8 +586,11 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
editBlogImageSection += ' <label class="labels">' + \ editBlogImageSection += ' <label class="labels">' + \
translate['Image description'] + '</label>' translate['Image description'] + '</label>'
editBlogImageSection += ' <input type="text" name="imageDescription">' editBlogImageSection += ' <input type="text" name="imageDescription">'
editBlogImageSection += ' <input type="file" id="attachpic" name="attachpic"' editBlogImageSection += \
editBlogImageSection += ' accept=".png, .jpg, .jpeg, .gif, .webp, .mp4, .webm, .ogv, .mp3, .ogg">' ' <input type="file" id="attachpic" name="attachpic"'
editBlogImageSection += \
' accept=".png, .jpg, .jpeg, .gif, .webp, ' + \
'.mp4, .webm, .ogv, .mp3, .ogg">'
editBlogImageSection += ' </div>' editBlogImageSection += ' </div>'
placeholderMessage = translate['Write something'] + '...' placeholderMessage = translate['Write something'] + '...'
@ -599,34 +602,48 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
dateAndLocation = '' dateAndLocation = ''
dateAndLocation = '<div class="container">' dateAndLocation = '<div class="container">'
dateAndLocation += '<p><input type="checkbox" class="profilecheckbox" name="schedulePost"><label class="labels">' + \ dateAndLocation += \
'<p><input type="checkbox" class="profilecheckbox" ' + \
'name="schedulePost"><label class="labels">' + \
translate['This is a scheduled post.'] + '</label></p>' translate['This is a scheduled post.'] + '</label></p>'
dateAndLocation += '<p><img loading="lazy" alt="" title="" class="emojicalendar" src="/' + \ dateAndLocation += \
'<p><img loading="lazy" alt="" title="" ' + \
'class="emojicalendar" src="/' + \
iconsDir + '/calendar.png"/>' iconsDir + '/calendar.png"/>'
dateAndLocation += '<label class="labels">' + translate['Date'] + ': </label>' dateAndLocation += \
'<label class="labels">' + translate['Date'] + ': </label>'
dateAndLocation += '<input type="date" name="eventDate">' dateAndLocation += '<input type="date" name="eventDate">'
dateAndLocation += '<label class="labelsright">' + translate['Time'] + ':' dateAndLocation += '<label class="labelsright">' + translate['Time'] + ':'
dateAndLocation += '<input type="time" name="eventTime"></label></p>' dateAndLocation += '<input type="time" name="eventTime"></label></p>'
dateAndLocation += '</div>' dateAndLocation += '</div>'
dateAndLocation += '<div class="container">' dateAndLocation += '<div class="container">'
dateAndLocation += '<br><label class="labels">' + translate['Location'] + ': </label>' dateAndLocation += \
'<br><label class="labels">' + translate['Location'] + ': </label>'
dateAndLocation += '<input type="text" name="location">' dateAndLocation += '<input type="text" name="location">'
dateAndLocation += '</div>' dateAndLocation += '</div>'
editBlogForm = htmlHeader(cssFilename, editBlogCSS) editBlogForm = htmlHeader(cssFilename, editBlogCSS)
editBlogForm += '<form enctype="multipart/form-data" method="POST" accept-charset="UTF-8" action="' + \ editBlogForm += \
'<form enctype="multipart/form-data" method="POST" ' + \
'accept-charset="UTF-8" action="' + \
pathBase + '?' + endpoint + '?page=' + str(pageNumber) + '">' pathBase + '?' + endpoint + '?page=' + str(pageNumber) + '">'
editBlogForm += ' <input type="hidden" name="postUrl" value="' + postUrl + '">' editBlogForm += \
editBlogForm += ' <input type="hidden" name="pageNumber" value="' + str(pageNumber) + '">' ' <input type="hidden" name="postUrl" value="' + postUrl + '">'
editBlogForm += \
' <input type="hidden" name="pageNumber" value="' + \
str(pageNumber) + '">'
editBlogForm += ' <div class="vertical-center">' editBlogForm += ' <div class="vertical-center">'
editBlogForm += ' <label for="nickname"><b>' + editBlogText + '</b></label>' editBlogForm += \
' <label for="nickname"><b>' + editBlogText + '</b></label>'
editBlogForm += ' <div class="container">' editBlogForm += ' <div class="container">'
editBlogForm += ' <div class="dropbtn">' editBlogForm += ' <div class="dropbtn">'
editBlogForm += ' <img loading="lazy" alt="" title="" src="/' + iconsDir + \ editBlogForm += \
'/' + scopeIcon + '"/><b class="scope-desc">' + scopeDescription + '</b>' ' <img loading="lazy" alt="" title="" src="/' + iconsDir + \
'/' + scopeIcon + '"/><b class="scope-desc">' + \
scopeDescription + '</b>'
editBlogForm += ' </div>' editBlogForm += ' </div>'
editBlogForm += ' <a href="' + pathBase + \ editBlogForm += ' <a href="' + pathBase + \
@ -644,19 +661,23 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
editBlogForm += ' </center></div>' editBlogForm += ' </center></div>'
if mediaInstance: if mediaInstance:
editBlogForm += editBlogImageSection editBlogForm += editBlogImageSection
editBlogForm += ' <label class="labels">' + placeholderSubject + '</label><br>' editBlogForm += \
' <label class="labels">' + placeholderSubject + '</label><br>'
titleStr = '' titleStr = ''
if postJsonObject['object'].get('summary'): if postJsonObject['object'].get('summary'):
titleStr = postJsonObject['object']['summary'] titleStr = postJsonObject['object']['summary']
editBlogForm += ' <input type="text" name="subject" value="' + titleStr + '">' editBlogForm += \
' <input type="text" name="subject" value="' + titleStr + '">'
editBlogForm += '' editBlogForm += ''
editBlogForm += ' <br><label class="labels">' + \ editBlogForm += ' <br><label class="labels">' + \
placeholderMessage + '</label>' placeholderMessage + '</label>'
messageBoxHeight = 800 messageBoxHeight = 800
contentStr = postJsonObject['object']['content'].replace('<p>', '').replace('</p>', '\n') contentStr = postJsonObject['object']['content']
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
editBlogForm += ' <textarea id="message" name="message" style="height:' + \ editBlogForm += \
' <textarea id="message" name="message" style="height:' + \
str(messageBoxHeight) + 'px">' + contentStr + '</textarea>' str(messageBoxHeight) + 'px">' + contentStr + '</textarea>'
editBlogForm += dateAndLocation editBlogForm += dateAndLocation
if not mediaInstance: if not mediaInstance:

View File

@ -10,7 +10,7 @@ echo "Starting static analysis"
for sourceFile in *.py for sourceFile in *.py
do do
if [[ "$sourceFile" == 'tests.py' ]]; then if [[ "$sourceFile" == 'tests.py' || "$sourceFile" == 'blurhash.py' || "$sourceFile" == 'capabilities.py' ]]; then
continue continue
fi fi
result=$($cmd "$sourceFile") result=$($cmd "$sourceFile")