Skip to content

Commit dedde58

Browse files
committed
removed camel case notation
1 parent f09f1d0 commit dedde58

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/api/endpoints.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
from app.api import api
77

8-
def renderError(msg, error_header="An error occured!", statusCode=500):
8+
def render_error(msg, error_header="An error occured!", statusCode=500):
99
return flask.render_template('error.html', error_header=error_header, error_message=msg), statusCode
1010

11-
def getValidSubpath(f: str, d: str):
11+
def get_valid_subpath(f: str, d: str):
1212
"""
1313
Returns the absolute path of wanted file or directory, but only if it is contained in the given directory.
1414
@@ -44,9 +44,9 @@ def get_config(name: str):
4444
"""
4545
nginx_path = flask.current_app.config['NGINX_PATH']
4646

47-
path = getValidSubpath(os.path.join(nginx_path, name), nginx_path)
47+
path = get_valid_subpath(os.path.join(nginx_path, name), nginx_path)
4848
if path == None:
49-
return renderError(f'Could not read file "{path}".')
49+
return render_error(f'Could not read file "{path}".')
5050

5151
with io.open(path, 'r') as f:
5252
_file = f.read()
@@ -70,7 +70,7 @@ def post_config(name: str):
7070

7171
config_file = os.path.join(nginx_path, name)
7272

73-
path = getValidSubpath(config_file, nginx_path)
73+
path = get_valid_subpath(config_file, nginx_path)
7474
if path == None:
7575
return flask.make_response({'success': False}), 500
7676

@@ -94,7 +94,7 @@ def get_domains():
9494

9595
if not os.path.exists(config_path):
9696
error_message = f'The config folder "{config_path}" does not exists.'
97-
return renderError(error_message)
97+
return render_error(error_message)
9898
for _ in os.listdir(config_path):
9999

100100
if os.path.isfile(os.path.join(config_path, _)):
@@ -168,7 +168,7 @@ def post_domain(name: str):
168168
new_domain = flask.render_template('new_domain.j2', name=name)
169169
name = name + '.conf.disabled'
170170

171-
path = getValidSubpath(os.path.join(config_path, name), config_path)
171+
path = get_valid_subpath(os.path.join(config_path, name), config_path)
172172
if path == None:
173173
return flask.jsonify({'success': False, 'error_msg': 'invalid domain path'}), 500
174174

0 commit comments

Comments
 (0)