Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
django-cas-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Samir
django-cas-server
Commits
93e11bef
Commit
93e11bef
authored
Mar 18, 2016
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[utils.py] Errors in utils.import_attr are more understandable.
parent
3f4a4366
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
cas_server/utils.py
cas_server/utils.py
+8
-1
No files found.
cas_server/utils.py
View file @
93e11bef
...
...
@@ -39,8 +39,15 @@ def import_attr(path):
"""transform a python module.attr path to the attr"""
if
not
isinstance
(
path
,
str
):
return
string
if
"."
not
in
path
:
ValueError
(
"%r should be of the form `module.attr` and we just got `attr`"
%
path
)
module
,
attr
=
path
.
rsplit
(
'.'
,
1
)
return
getattr
(
import_module
(
module
),
attr
)
try
:
return
getattr
(
import_module
(
module
),
attr
)
except
ImportError
:
raise
ImportError
(
"Module %r not found"
%
module
)
except
AttributeError
:
raise
AttributeError
(
"Module %r has not attribut %r"
%
(
module
,
attr
))
def
redirect_params
(
url_name
,
params
=
None
):
...
...
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