Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
b188c8e7
Commit
b188c8e7
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
fix bug in string splitting.
parent
9c7f2cf6
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/instructor/views.py
+5
-3
5 additions, 3 deletions
lms/djangoapps/instructor/views.py
with
5 additions
and
3 deletions
lms/djangoapps/instructor/views.py
+
5
−
3
View file @
b188c8e7
...
...
@@ -2,6 +2,7 @@
from
collections
import
defaultdict
import
csv
import
itertools
import
json
import
logging
import
os
...
...
@@ -798,14 +799,15 @@ def _split_by_comma_and_whitespace(s):
Split a string both by on commas and whitespice.
"""
# Note: split() with no args removes empty strings from output
return
[
x
.
split
()
for
x
in
s
.
split
(
'
,
'
)]
lists
=
[
x
.
split
()
for
x
in
s
.
split
(
'
,
'
)]
# return all of them
return
itertools
.
chain
(
*
lists
)
def
_do_enroll_students
(
course
,
course_id
,
students
,
overload
=
False
):
"""
Do the actual work of enrolling multiple students, presented as a string
of emails separated by commas or returns
"""
ns
=
_split_by_comma_and_whitespace
(
students
)
new_students
=
[
item
for
sublist
in
ns
for
item
in
sublist
]
new_students
=
_split_by_comma_and_whitespace
(
students
)
new_students
=
[
str
(
s
.
strip
())
for
s
in
new_students
]
new_students_lc
=
[
x
.
lower
()
for
x
in
new_students
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment