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
b188c8e7
Commit
b188c8e7
authored
Jan 15, 2013
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug in string splitting.
parent
9c7f2cf6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lms/djangoapps/instructor/views.py
+5
-3
No files found.
lms/djangoapps/instructor/views.py
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
]
...
...
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