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
4d30aedf
Commit
4d30aedf
authored
Nov 09, 2014
by
stv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PEP8: E127 continuation line over-indented
for visual indent
parent
6763c5dd
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
62 additions
and
27 deletions
+62
-27
common/djangoapps/course_groups/cohorts.py
+4
-2
common/djangoapps/course_groups/models.py
+5
-2
common/djangoapps/geoinfo/tests/test_middleware.py
+16
-8
common/djangoapps/student/management/commands/userinfo.py
+4
-2
common/djangoapps/track/middleware.py
+4
-2
common/lib/chem/chem/chemcalc.py
+7
-2
lms/djangoapps/courseware/grades.py
+4
-2
lms/djangoapps/lms_migration/management/commands/create_user.py
+5
-2
lms/djangoapps/open_ended_grading/open_ended_notifications.py
+6
-2
pavelib/paver_tests/test_paver_bok_choy_cmds.py
+7
-3
No files found.
common/djangoapps/course_groups/cohorts.py
View file @
4d30aedf
...
...
@@ -219,9 +219,11 @@ def get_cohort(user, course_key):
return
None
try
:
return
CourseUserGroup
.
objects
.
get
(
course_id
=
course_key
,
return
CourseUserGroup
.
objects
.
get
(
course_id
=
course_key
,
group_type
=
CourseUserGroup
.
COHORT
,
users__id
=
user
.
id
)
users__id
=
user
.
id
,
)
except
CourseUserGroup
.
DoesNotExist
:
# Didn't find the group. We'll go on to create one if needed.
pass
...
...
common/djangoapps/course_groups/models.py
View file @
4d30aedf
...
...
@@ -24,8 +24,11 @@ class CourseUserGroup(models.Model):
# Note: groups associated with particular runs of a course. E.g. Fall 2012 and Spring
# 2013 versions of 6.00x will have separate groups.
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
,
help_text
=
"Which course is this group associated with?"
)
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
,
help_text
=
"Which course is this group associated with?"
,
)
# For now, only have group type 'cohort', but adding a type field to support
# things like 'question_discussion', 'friends', 'off-line-class', etc
...
...
common/djangoapps/geoinfo/tests/test_middleware.py
View file @
4d30aedf
...
...
@@ -46,8 +46,10 @@ class CountryMiddlewareTests(TestCase):
return
ip_dict
.
get
(
ip_addr
,
'US'
)
def
test_country_code_added
(
self
):
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.1'
)
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.1'
,
)
request
.
user
=
self
.
authenticated_user
self
.
session_middleware
.
process_request
(
request
)
# No country code exists before request.
...
...
@@ -59,8 +61,10 @@ class CountryMiddlewareTests(TestCase):
self
.
assertEqual
(
'117.79.83.1'
,
request
.
session
.
get
(
'ip_address'
))
def
test_ip_address_changed
(
self
):
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'4.0.0.0'
)
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'4.0.0.0'
,
)
request
.
user
=
self
.
anonymous_user
self
.
session_middleware
.
process_request
(
request
)
request
.
session
[
'country_code'
]
=
'CN'
...
...
@@ -71,8 +75,10 @@ class CountryMiddlewareTests(TestCase):
self
.
assertEqual
(
'4.0.0.0'
,
request
.
session
.
get
(
'ip_address'
))
def
test_ip_address_is_not_changed
(
self
):
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.1'
)
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.1'
,
)
request
.
user
=
self
.
anonymous_user
self
.
session_middleware
.
process_request
(
request
)
request
.
session
[
'country_code'
]
=
'CN'
...
...
@@ -83,8 +89,10 @@ class CountryMiddlewareTests(TestCase):
self
.
assertEqual
(
'117.79.83.1'
,
request
.
session
.
get
(
'ip_address'
))
def
test_same_country_different_ip
(
self
):
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.100'
)
request
=
self
.
request_factory
.
get
(
'/somewhere'
,
HTTP_X_FORWARDED_FOR
=
'117.79.83.100'
,
)
request
.
user
=
self
.
anonymous_user
self
.
session_middleware
.
process_request
(
request
)
request
.
session
[
'country_code'
]
=
'CN'
...
...
common/djangoapps/student/management/commands/userinfo.py
View file @
4d30aedf
...
...
@@ -19,13 +19,15 @@ Pass a single filename."""
l
=
[]
for
user
in
users
:
up
=
UserProfile
.
objects
.
get
(
user
=
user
)
d
=
{
'username'
:
user
.
username
,
d
=
{
'username'
:
user
.
username
,
'email'
:
user
.
email
,
'is_active'
:
user
.
is_active
,
'joined'
:
user
.
date_joined
.
isoformat
(),
'name'
:
up
.
name
,
'language'
:
up
.
language
,
'location'
:
up
.
location
}
'location'
:
up
.
location
,
}
l
.
append
(
d
)
json
.
dump
(
l
,
f
)
f
.
close
()
common/djangoapps/track/middleware.py
View file @
4d30aedf
...
...
@@ -59,8 +59,10 @@ class TrackMiddleware(object):
if
string
in
get_dict
:
get_dict
[
string
]
=
'*'
*
8
event
=
{
'GET'
:
dict
(
get_dict
),
'POST'
:
dict
(
post_dict
)}
event
=
{
'GET'
:
dict
(
get_dict
),
'POST'
:
dict
(
post_dict
),
}
# TODO: Confirm no large file uploads
event
=
json
.
dumps
(
event
)
...
...
common/lib/chem/chem/chemcalc.py
View file @
4d30aedf
...
...
@@ -339,8 +339,13 @@ def divide_chemical_expression(s1, s2, ignore_state=False):
if
treedic
[
'1 phases'
]
!=
treedic
[
'2 phases'
]:
return
False
if
any
(
map
(
lambda
x
,
y
:
x
/
y
-
treedic
[
'1 factors'
][
0
]
/
treedic
[
'2 factors'
][
0
],
treedic
[
'1 factors'
],
treedic
[
'2 factors'
])):
if
any
(
map
(
lambda
x
,
y
:
x
/
y
-
treedic
[
'1 factors'
][
0
]
/
treedic
[
'2 factors'
][
0
],
treedic
[
'1 factors'
],
treedic
[
'2 factors'
],
)
):
# factors are not proportional
return
False
else
:
...
...
lms/djangoapps/courseware/grades.py
View file @
4d30aedf
...
...
@@ -260,8 +260,10 @@ def _grade(student, request, course, keep_raw_scores):
if
graded_total
.
possible
>
0
:
format_scores
.
append
(
graded_total
)
else
:
log
.
info
(
"Unable to grade a section with a total possible score of zero. "
+
str
(
section_descriptor
.
location
))
log
.
info
(
"Unable to grade a section with a total possible score of zero. "
+
str
(
section_descriptor
.
location
)
)
totaled_scores
[
section_format
]
=
format_scores
...
...
lms/djangoapps/lms_migration/management/commands/create_user.py
View file @
4d30aedf
...
...
@@ -28,8 +28,11 @@ class MyCompleter(object): # Custom completer
def
complete
(
self
,
text
,
state
):
if
state
==
0
:
# on first trigger, build possible matches
if
text
:
# cache matches (entries that start with entered text)
self
.
matches
=
[
s
for
s
in
self
.
options
if
s
and
s
.
startswith
(
text
)]
self
.
matches
=
[
option
for
option
in
self
.
options
if
option
and
option
.
startswith
(
text
)
]
else
:
# no text entered, all matches possible
self
.
matches
=
self
.
options
[:]
...
...
lms/djangoapps/open_ended_grading/open_ended_notifications.py
View file @
4d30aedf
...
...
@@ -158,8 +158,12 @@ def combined_notifications(course, user):
try
:
#Get the notifications from the grading controller
notifications
=
controller_qs
.
check_combined_notifications
(
course
.
id
,
student_id
,
user_is_staff
,
last_time_viewed
)
notifications
=
controller_qs
.
check_combined_notifications
(
course
.
id
,
student_id
,
user_is_staff
,
last_time_viewed
,
)
if
notifications
.
get
(
'success'
):
if
(
notifications
.
get
(
'staff_needs_to_grade'
)
or
notifications
.
get
(
'student_needs_to_peer_grade'
)):
...
...
pavelib/paver_tests/test_paver_bok_choy_cmds.py
View file @
4d30aedf
...
...
@@ -14,14 +14,18 @@ class TestPaverBokChoy(unittest.TestCase):
def
_expected_command
(
self
,
expected_text_append
):
if
expected_text_append
:
expected_text_append
=
"/"
+
expected_text_append
expected_statement
=
(
"DEFAULT_STORE=None SCREENSHOT_DIR='{repo_dir}/test_root/log' "
expected_statement
=
(
"DEFAULT_STORE=None SCREENSHOT_DIR='{repo_dir}/test_root/log' "
"BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' "
"SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
"nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
"--with-xunit "
"--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
"--verbosity=2 "
.
format
(
repo_dir
=
REPO_DIR
,
exp_text
=
expected_text_append
))
"--verbosity=2 "
.
format
(
repo_dir
=
REPO_DIR
,
exp_text
=
expected_text_append
,
)
)
return
expected_statement
def
test_default_bokchoy
(
self
):
...
...
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