mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-08 21:53:36 +00:00
Strip blanks, handle empty entries in gam file and gam csvfile
This commit is contained in:
13
src/gam.py
13
src/gam.py
@ -8664,8 +8664,12 @@ def getUsersToModify(entity_type=None, entity=None, silent=False, return_uids=Fa
|
||||
pass
|
||||
elif entity_type == u'file':
|
||||
users = []
|
||||
filename = entity
|
||||
users = readFile(filename, u'rb').splitlines()
|
||||
f = openFile(entity)
|
||||
for row in f:
|
||||
user = row.strip()
|
||||
if user:
|
||||
users.append(user)
|
||||
closeFile(f)
|
||||
elif entity_type == u'csvfile':
|
||||
try:
|
||||
(filename, column) = entity.split(u':')
|
||||
@ -8679,8 +8683,9 @@ def getUsersToModify(entity_type=None, entity=None, silent=False, return_uids=Fa
|
||||
systemErrorExit(2, MESSAGE_HEADER_NOT_FOUND_IN_CSV_HEADERS.format(column, ','.join(input_file.fieldnames)))
|
||||
users = []
|
||||
for row in input_file:
|
||||
if column in row:
|
||||
users.append(row[column])
|
||||
user = row[column].strip()
|
||||
if user:
|
||||
users.append(user)
|
||||
closeFile(f)
|
||||
elif entity_type in [u'courseparticipants', u'teachers', u'students']:
|
||||
croom = buildGAPIObject(u'classroom')
|
||||
|
Reference in New Issue
Block a user