Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
32a4c227
Commit
32a4c227
authored
Feb 03, 2020
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{dev bugfix} removed usage of parse error on account validation
parent
8c97b2d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
app/helper/decorators.py
app/helper/decorators.py
+19
-8
No files found.
app/helper/decorators.py
View file @
32a4c227
...
@@ -61,14 +61,20 @@ class rms:
...
@@ -61,14 +61,20 @@ class rms:
def
user_create
(
function
):
def
user_create
(
function
):
@
wraps
(
function
)
@
wraps
(
function
)
def
wrapper
(
self
,
request
,
*
args
,
**
kwargs
):
def
wrapper
(
self
,
request
,
*
args
,
**
kwargs
):
print
(
rms
.
user_type
(
self
))
if
rms
.
user_type
(
self
)
==
rms
.
enums_user
:
if
rms
.
user_type
(
self
)
==
rms
.
enums_user
:
raise
ParseError
(
# raise ParseError(
rms
.
access_error
# rms.access_error
# )
return
Response
(
{
"message"
:
rms
.
access_error
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
)
elif
rms
.
user_type
(
self
)
==
rms
.
enums_department
:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_department
:
if
request
.
data
[
'department'
]
!=
rms
.
user
(
self
)
.
department
.
code
:
if
request
.
data
[
'department'
]
!=
rms
.
user
(
self
)
.
department
.
code
:
raise
ParseError
(
return
Response
(
rms
.
department_error
{
"message"
:
rms
.
department_error
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
)
elif
rms
.
user_type
(
self
)
==
rms
.
enums_company
:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_company
:
user_company
=
rms
.
user
(
self
)
.
department
.
company
user_company
=
rms
.
user
(
self
)
.
department
.
company
...
@@ -77,8 +83,10 @@ class rms:
...
@@ -77,8 +83,10 @@ class rms:
Q
(
company
=
user_company
)
Q
(
company
=
user_company
)
)
)
if
not
request_department
:
if
not
request_department
:
raise
ParseError
(
rms
.
company_error
)
return
Response
(
{
"message"
:
rms
.
company_error
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
wrapper
return
wrapper
...
@@ -92,9 +100,12 @@ class rms:
...
@@ -92,9 +100,12 @@ class rms:
if
username
.
count
()
>=
1
:
if
username
.
count
()
>=
1
:
return
Response
(
return
Response
(
{
{
"message"
:
f
"username {username.first().username} is already taken"
,
"message"
:
f
"username {username.first().username} is already taken"
},
status
=
status
.
HTTP_400_BAD_REQUEST
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
)
# rms.user_create(self, request, *args, **kwargs)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
wrapper
return
wrapper
...
...
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