Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
741f3a7b
Commit
741f3a7b
authored
Jun 09, 2020
by
Vladislav Rykov
Browse files
fixed render_template <-> redirect
parent
37e829c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
741f3a7b
No preview for this file type
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
741f3a7b
No preview for this file type
app/app/views.py
View file @
741f3a7b
...
...
@@ -125,7 +125,7 @@ def application_create():
elif
request
.
method
==
'POST'
:
if
request
.
form
[
'appname'
]
==
''
:
flash
(
'Application name cannot be empty.'
,
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
elif
request
.
method
==
'POST'
:
appkey
=
misc
.
rand_str
(
app
.
config
[
'APPKEY_LENGTH'
]).
decode
(
'utf-8'
)
secure_key
=
misc
.
gen_skey_b64
(
16
)
...
...
@@ -138,14 +138,14 @@ def application_create():
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
res
=
dd
.
create_table_ddm
(
appkey
)
if
not
res
[
0
]:
ad
.
delete
(
appkey
)
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
return
redirect
(
url_for
(
'applications'
))
...
...
@@ -211,13 +211,13 @@ def application_add_device(appkey):
res
=
dd
.
create_ddm
(
request
.
form
[
'devname'
],
request
.
form
[
'devid'
],
appkey
,
request
.
form
[
'devdesc'
],
ddmin
)
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
else
:
res
=
data
.
create_table_ddm
(
appkey
,
request
.
form
[
'devid'
])
if
not
res
[
0
]:
dd
.
delete
(
session
[
'appkey'
],
request
.
form
[
'devid'
])
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
else
:
return
redirect
(
url_for
(
'application'
,
appkey
=
appkey
))
...
...
@@ -565,7 +565,7 @@ def application_settings(appkey):
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
return
redirect
(
request
.
url
)
...
...
app/app/views_admin.py
View file @
741f3a7b
...
...
@@ -86,7 +86,7 @@ def administration_user_new_application(name):
elif
request
.
method
==
'POST'
:
if
request
.
form
[
'appname'
]
==
''
:
flash
(
'Application name cannot be empty.'
,
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
elif
request
.
method
==
'POST'
:
appkey
=
misc
.
rand_str
(
app
.
config
[
'APPKEY_LENGTH'
]).
decode
(
'utf-8'
)
secure_key
=
misc
.
gen_skey_b64
(
16
)
...
...
@@ -99,14 +99,14 @@ def administration_user_new_application(name):
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
res
=
dd
.
create_table_ddm
(
appkey
)
if
not
res
[
0
]:
ad
.
delete
(
appkey
)
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
return
redirect
(
url_for
(
'administration_user_applications'
,
name
=
name
))
...
...
@@ -322,7 +322,7 @@ def administration_user_application_settings(name, appkey):
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
re
nder_template
(
request
.
url
)
return
re
direct
(
request
.
url
)
return
redirect
(
request
.
url
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment