Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
edx
edx-platform
Commits
8ddd8c14
Commit
8ddd8c14
authored
Nov 01, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pylint/pep8 errors
parent
da26ae25
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
33 deletions
+41
-33
common/djangoapps/student/models.py
+1
-0
common/lib/symmath/symmath/formula.py
+1
-2
lms/djangoapps/courseware/tests/test_module_render.py
+3
-0
lms/djangoapps/django_comment_client/permissions.py
+35
-30
lms/lib/comment_client/models.py
+1
-1
No files found.
common/djangoapps/student/models.py
View file @
8ddd8c14
...
@@ -41,6 +41,7 @@ unenroll_done = django.dispatch.Signal(providing_args=["course_enrollment"])
...
@@ -41,6 +41,7 @@ unenroll_done = django.dispatch.Signal(providing_args=["course_enrollment"])
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
AUDIT_LOG
=
logging
.
getLogger
(
"audit"
)
AUDIT_LOG
=
logging
.
getLogger
(
"audit"
)
class
UserStanding
(
models
.
Model
):
class
UserStanding
(
models
.
Model
):
"""
"""
This table contains a student's account's status.
This table contains a student's account's status.
...
...
common/lib/symmath/symmath/formula.py
View file @
8ddd8c14
...
@@ -14,6 +14,7 @@ import string # pylint: disable=W0402
...
@@ -14,6 +14,7 @@ import string # pylint: disable=W0402
import
re
import
re
import
logging
import
logging
import
operator
import
operator
import
requests
import
sympy
import
sympy
from
sympy.printing.latex
import
LatexPrinter
from
sympy.printing.latex
import
LatexPrinter
from
sympy.printing.str
import
StrPrinter
from
sympy.printing.str
import
StrPrinter
...
@@ -25,11 +26,9 @@ from sympy.physics.quantum.state import *
...
@@ -25,11 +26,9 @@ from sympy.physics.quantum.state import *
# import sympy.physics.quantum.qubit
# import sympy.physics.quantum.qubit
from
xml.sax.saxutils
import
unescape
from
xml.sax.saxutils
import
unescape
import
sympy
import
unicodedata
import
unicodedata
from
lxml
import
etree
from
lxml
import
etree
#import subprocess
#import subprocess
import
requests
from
copy
import
deepcopy
from
copy
import
deepcopy
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
...
lms/djangoapps/courseware/tests/test_module_render.py
View file @
8ddd8c14
...
@@ -26,6 +26,9 @@ from .factories import UserFactory
...
@@ -26,6 +26,9 @@ from .factories import UserFactory
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
ModuleRenderTestCase
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
ModuleRenderTestCase
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
Tests of courseware.module_render
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
location
=
[
'i4x'
,
'edX'
,
'toy'
,
'chapter'
,
'Overview'
]
self
.
location
=
[
'i4x'
,
'edX'
,
'toy'
,
'chapter'
,
'Overview'
]
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
course_id
=
'edX/toy/2012_Fall'
...
...
lms/djangoapps/django_comment_client/permissions.py
View file @
8ddd8c14
"""
Module for checking permissions with the comment_client backend
"""
import
logging
import
logging
from
util.cache
import
cache
from
django.core
import
cache
from
django.core
import
cache
cache
=
cache
.
get_cache
(
'default'
)
CACHE
=
cache
.
get_cache
(
'default'
)
CACHE_LIFESPAN
=
60
def
cached_has_permission
(
user
,
permission
,
course_id
=
None
):
def
cached_has_permission
(
user
,
permission
,
course_id
=
None
):
...
@@ -9,12 +15,11 @@ def cached_has_permission(user, permission, course_id=None):
...
@@ -9,12 +15,11 @@ def cached_has_permission(user, permission, course_id=None):
Call has_permission if it's not cached. A change in a user's role or
Call has_permission if it's not cached. A change in a user's role or
a role's permissions will only become effective after CACHE_LIFESPAN seconds.
a role's permissions will only become effective after CACHE_LIFESPAN seconds.
"""
"""
CACHE_LIFESPAN
=
60
key
=
"permission_
%
d_
%
s_
%
s"
%
(
user
.
id
,
str
(
course_id
),
permission
)
key
=
"permission_
%
d_
%
s_
%
s"
%
(
user
.
id
,
str
(
course_id
),
permission
)
val
=
cache
.
get
(
key
,
None
)
val
=
CACHE
.
get
(
key
,
None
)
if
val
not
in
[
True
,
False
]:
if
val
not
in
[
True
,
False
]:
val
=
has_permission
(
user
,
permission
,
course_id
=
course_id
)
val
=
has_permission
(
user
,
permission
,
course_id
=
course_id
)
cache
.
set
(
key
,
val
,
CACHE_LIFESPAN
)
CACHE
.
set
(
key
,
val
,
CACHE_LIFESPAN
)
return
val
return
val
...
@@ -72,31 +77,31 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
...
@@ -72,31 +77,31 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
VIEW_PERMISSIONS
=
{
VIEW_PERMISSIONS
=
{
'update_thread'
:
[
'edit_content'
,
[
'update_thread'
,
'is_open'
,
'is_author'
]],
'update_thread'
:
[
'edit_content'
,
[
'update_thread'
,
'is_open'
,
'is_author'
]],
'create_comment'
:
[[
"create_comment"
,
"is_open"
]],
'create_comment'
:
[[
"create_comment"
,
"is_open"
]],
'delete_thread'
:
[
'delete_thread'
,
[
'update_thread'
,
'is_author'
]],
'delete_thread'
:
[
'delete_thread'
,
[
'update_thread'
,
'is_author'
]],
'update_comment'
:
[
'edit_content'
,
[
'update_comment'
,
'is_open'
,
'is_author'
]],
'update_comment'
:
[
'edit_content'
,
[
'update_comment'
,
'is_open'
,
'is_author'
]],
'endorse_comment'
:
[
'endorse_comment'
],
'endorse_comment'
:
[
'endorse_comment'
],
'openclose_thread'
:
[
'openclose_thread'
],
'openclose_thread'
:
[
'openclose_thread'
],
'create_sub_comment'
:
[[
'create_sub_comment'
,
'is_open'
]],
'create_sub_comment'
:
[[
'create_sub_comment'
,
'is_open'
]],
'delete_comment'
:
[
'delete_comment'
,
[
'update_comment'
,
'is_open'
,
'is_author'
]],
'delete_comment'
:
[
'delete_comment'
,
[
'update_comment'
,
'is_open'
,
'is_author'
]],
'vote_for_comment'
:
[[
'vote'
,
'is_open'
]],
'vote_for_comment'
:
[[
'vote'
,
'is_open'
]],
'undo_vote_for_comment'
:
[[
'unvote'
,
'is_open'
]],
'undo_vote_for_comment'
:
[[
'unvote'
,
'is_open'
]],
'vote_for_thread'
:
[[
'vote'
,
'is_open'
]],
'vote_for_thread'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'un_flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'un_flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_comment'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_comment'
:
[[
'vote'
,
'is_open'
]],
'un_flag_abuse_for_comment'
:
[[
'vote'
,
'is_open'
]],
'un_flag_abuse_for_comment'
:
[[
'vote'
,
'is_open'
]],
'undo_vote_for_thread'
:
[[
'unvote'
,
'is_open'
]],
'undo_vote_for_thread'
:
[[
'unvote'
,
'is_open'
]],
'pin_thread'
:
[
'create_comment'
],
'pin_thread'
:
[
'create_comment'
],
'un_pin_thread'
:
[
'create_comment'
],
'un_pin_thread'
:
[
'create_comment'
],
'follow_thread'
:
[
'follow_thread'
],
'follow_thread'
:
[
'follow_thread'
],
'follow_commentable'
:
[
'follow_commentable'
],
'follow_commentable'
:
[
'follow_commentable'
],
'follow_user'
:
[
'follow_user'
],
'follow_user'
:
[
'follow_user'
],
'unfollow_thread'
:
[
'unfollow_thread'
],
'unfollow_thread'
:
[
'unfollow_thread'
],
'unfollow_commentable'
:
[
'unfollow_commentable'
],
'unfollow_commentable'
:
[
'unfollow_commentable'
],
'unfollow_user'
:
[
'unfollow_user'
],
'unfollow_user'
:
[
'unfollow_user'
],
'create_thread'
:
[
'create_thread'
],
'create_thread'
:
[
'create_thread'
],
'update_moderator_status'
:
[
'manage_moderator'
],
'update_moderator_status'
:
[
'manage_moderator'
],
}
}
...
...
lms/lib/comment_client/models.py
View file @
8ddd8c14
from
.utils
import
*
from
.utils
import
extract
,
perform_request
,
CommentClientRequestError
class
Model
(
object
):
class
Model
(
object
):
...
...
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