Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
rc
self-reg-form
Commits
c3e552ec
Commit
c3e552ec
authored
Oct 02, 2020
by
Krish Moodbidri
Browse files
pass user input as a json object from flask to celery
parent
2edc9b99
Changes
2
Hide whitespace changes
Inline
Side-by-side
run.py
View file @
c3e552ec
...
...
@@ -36,7 +36,7 @@ def request_account(json, methods=['GET', 'POST']):
room
=
str
(
session
[
'uid'
])
print
(
"Room: {}"
.
format
(
room
))
try
:
tasks
.
celery_create_account
.
delay
(
json
[
'username'
],
json
[
'email'
],
json
[
'fullname'
],
json
[
'reason'
]
,
session
=
room
)
tasks
.
celery_create_account
.
delay
(
json
,
session
=
room
)
except
Exception
as
e
:
print
(
time
.
strftime
(
"%m-%d-%Y_%H:%M:%S"
)
+
"
\t
Error in account creation: "
,
e
)
socketio
.
emit
(
"Account creation failed"
,
room
)
...
...
tasks.py
View file @
c3e552ec
...
...
@@ -19,8 +19,13 @@ def send_msg(event, room):
@
celery
.
task
def
celery_create_account
(
username
,
fullname
,
rea
son
,
session
):
def
celery_create_account
(
j
son
,
session
):
room
=
session
username
=
json
[
'username'
]
email
=
json
[
'email'
]
fullname
=
json
[
'fullname'
]
reason
=
json
[
'reason'
]
print
(
time
.
strftime
(
"%m-%d-%Y_%H:%M:%S"
)
+
'
\t
User '
+
username
+
' added to queue'
)
send_msg
(
'creating account'
,
room
)
print
(
username
)
...
...
Write
Preview
Markdown
is supported
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