flake8: E203 whitespace before ':'

This commit is contained in:
sshakndr
2023-10-23 15:11:07 +07:00
parent 11fedb58bd
commit f1670c38df
3 changed files with 27 additions and 27 deletions

View File

@ -307,21 +307,21 @@ def getFilesInfo(req):
stats = os.stat(os.path.join(getRootFolder(req), f.get("title"))) # get file information stats = os.stat(os.path.join(getRootFolder(req), f.get("title"))) # get file information
result.append( # write file parameters to the file object result.append( # write file parameters to the file object
{ {
"version" : historyManager.getFileVersion(historyManager.getHistoryDir(getStoragePath(f.get("title"), req))), "version": historyManager.getFileVersion(historyManager.getHistoryDir(getStoragePath(f.get("title"), req))),
"id" : generateFileKey(f.get("title"), req), "id": generateFileKey(f.get("title"), req),
"contentLength" : "%.2f KB" % (stats.st_size/1024), "contentLength": "%.2f KB" % (stats.st_size/1024),
"pureContentLength" : stats.st_size, "pureContentLength": stats.st_size,
"title" : f.get("title"), "title": f.get("title"),
"updated" : time.strftime("%Y-%m-%dT%X%z",time.gmtime(stats.st_mtime)) "updated": time.strftime("%Y-%m-%dT%X%z",time.gmtime(stats.st_mtime))
}) })
if fileId : # if file id is defined if fileId: # if file id is defined
if fileId == generateFileKey(f.get("title"), req) : # and it is equal to the file key value if fileId == generateFileKey(f.get("title"), req): # and it is equal to the file key value
resultID.append(result[-1]) # add file object to the response array resultID.append(result[-1]) # add file object to the response array
if fileId : if fileId:
if len(resultID) > 0 : return resultID if len(resultID) > 0: return resultID
else : return "File not found" else: return "File not found"
else : else:
return result return result

View File

@ -142,7 +142,7 @@ def processForceSave(body, filename, usAddr):
if(isSubmitForm): if(isSubmitForm):
if (newFilename): if (newFilename):
filename = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + "-form" + downloadExt, usAddr) # get the correct file name if it already exists filename = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + "-form" + downloadExt, usAddr) # get the correct file name if it already exists
else : else:
filename = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + "-form" + curExt, usAddr) filename = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + "-form" + curExt, usAddr)
forcesavePath = docManager.getStoragePath(filename, usAddr) forcesavePath = docManager.getStoragePath(filename, usAddr)
else: else:

View File

@ -185,7 +185,7 @@ def edit(request):
edMode = request.GET.get('mode') if request.GET.get('mode') else 'edit' # get the editor mode: view/edit/review/comment/fillForms/embedded (the default mode is edit) edMode = request.GET.get('mode') if request.GET.get('mode') else 'edit' # get the editor mode: view/edit/review/comment/fillForms/embedded (the default mode is edit)
canEdit = docManager.isCanEdit(ext) # check if the file with this extension can be edited canEdit = docManager.isCanEdit(ext) # check if the file with this extension can be edited
if (((not canEdit) and edMode == 'edit') or edMode == 'fillForms') and docManager.isCanFillForms(ext) : if (((not canEdit) and edMode == 'edit') or edMode == 'fillForms') and docManager.isCanFillForms(ext):
edMode = 'fillForms' edMode = 'fillForms'
canEdit = True canEdit = True
submitForm = edMode == 'fillForms' and user.id == 'uid-1' and False # if the Submit form button is displayed or hidden submitForm = edMode == 'fillForms' and user.id == 'uid-1' and False # if the Submit form button is displayed or hidden
@ -255,9 +255,9 @@ def edit(request):
'userInfoGroups': user.userInfoGroups, 'userInfoGroups': user.userInfoGroups,
'protect': 'protect' not in user.deniedPermissions 'protect': 'protect' not in user.deniedPermissions
}, },
'referenceData' : { 'referenceData': {
'instanceId' : docManager.getServerUrl(False, request), 'instanceId': docManager.getServerUrl(False, request),
'fileKey' : json.dumps({'fileName' : filename, 'userAddress': request.META['REMOTE_ADDR']}) if user.id !='uid-0' else None 'fileKey': json.dumps({'fileName': filename, 'userAddress': request.META['REMOTE_ADDR']}) if user.id !='uid-0' else None
} }
}, },
'editorConfig': { 'editorConfig': {
@ -270,8 +270,8 @@ def edit(request):
"change": False "change": False
} }
if edMode == 'view' and user.id =='uid-0' else None, if edMode == 'view' and user.id =='uid-0' else None,
'createUrl' : createUrl if user.id !='uid-0' else None, 'createUrl': createUrl if user.id !='uid-0' else None,
'templates' : templates if user.templates else None, 'templates': templates if user.templates else None,
'user': { # the user currently viewing or editing the document 'user': { # the user currently viewing or editing the document
'id': user.id if user.id !='uid-0' else None, 'id': user.id if user.id !='uid-0' else None,
'name': user.name, 'name': user.name,
@ -343,7 +343,7 @@ def edit(request):
'historyData': json.dumps(hist['historyData']) if 'historyData' in hist else None, # the information about the previous document versions if they exist 'historyData': json.dumps(hist['historyData']) if 'historyData' in hist else None, # the information about the previous document versions if they exist
'fileType': fileType, # the file type of the document (text, spreadsheet or presentation) 'fileType': fileType, # the file type of the document (text, spreadsheet or presentation)
'apiUrl': config_manager.document_server_api_url().geturl(), # the absolute URL to the api 'apiUrl': config_manager.document_server_api_url().geturl(), # the absolute URL to the api
'dataInsertImage': json.dumps(dataInsertImage)[1 : len(json.dumps(dataInsertImage)) - 1], # the image which will be inserted into the document 'dataInsertImage': json.dumps(dataInsertImage)[1: len(json.dumps(dataInsertImage)) - 1], # the image which will be inserted into the document
'dataDocument': dataDocument, # document which will be compared with the current document 'dataDocument': dataDocument, # document which will be compared with the current document
'dataSpreadsheet': json.dumps(dataSpreadsheet), # recipient data for mail merging 'dataSpreadsheet': json.dumps(dataSpreadsheet), # recipient data for mail merging
'usersForMentions': json.dumps(usersForMentions) if user.id !='uid-0' else None 'usersForMentions': json.dumps(usersForMentions) if user.id !='uid-0' else None
@ -507,15 +507,15 @@ def reference(request):
return HttpResponse(json.dumps(response), content_type='application/json', status=404) return HttpResponse(json.dumps(response), content_type='application/json', status=404)
data = { data = {
'fileType' : fileUtils.getFileExt(fileName).replace('.', ''), 'fileType': fileUtils.getFileExt(fileName).replace('.', ''),
'key': docManager.generateFileKey(fileName,request), 'key': docManager.generateFileKey(fileName,request),
'url' : docManager.getDownloadUrl(fileName, request), 'url': docManager.getDownloadUrl(fileName, request),
'directUrl' : docManager.getDownloadUrl(fileName, request, False) if body["directUrl"] else None, 'directUrl': docManager.getDownloadUrl(fileName, request, False) if body["directUrl"] else None,
'referenceData' : { 'referenceData': {
'instanceId' : docManager.getServerUrl(False, request), 'instanceId': docManager.getServerUrl(False, request),
'fileKey' : json.dumps({'fileName' : fileName, 'userAddress': request.META['REMOTE_ADDR']}) 'fileKey': json.dumps({'fileName': fileName, 'userAddress': request.META['REMOTE_ADDR']})
}, },
'path' : fileName 'path': fileName
} }
if (jwtManager.isEnabled()): if (jwtManager.isEnabled()):