Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
4028796a
Commit
4028796a
authored
Oct 24, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide defaults for settings (so that they can be ommited) (issue #131)
parent
89787095
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
weblate/accounts/middleware.py
weblate/accounts/middleware.py
+8
-2
No files found.
weblate/accounts/middleware.py
View file @
4028796a
...
...
@@ -45,8 +45,14 @@ class RequireLoginMiddleware(object):
define any exceptions (like login and logout URLs).
"""
def
__init__
(
self
):
self
.
required
=
tuple
([
re
.
compile
(
url
)
for
url
in
settings
.
LOGIN_REQUIRED_URLS
])
self
.
exceptions
=
tuple
([
re
.
compile
(
url
)
for
url
in
settings
.
LOGIN_REQUIRED_URLS_EXCEPTIONS
])
self
.
required
=
self
.
get_setting_re
(
'LOGIN_REQUIRED_URLS'
,
[])
self
.
exceptions
=
self
.
get_setting_re
(
'LOGIN_REQUIRED_URLS_EXCEPTIONS'
,
[
r'/accounts/(.*)$'
])
def
get_setting_re
(
self
,
name
,
default
):
'''
Grabs regexp list from settings and compiles them
'''
return
tuple
([
re
.
compile
(
url
)
for
url
in
getattr
(
settings
,
name
,
default
)])
def
process_view
(
self
,
request
,
view_func
,
view_args
,
view_kwargs
):
# No need to process URLs if user already logged in
...
...
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