misc: use print as a function
This commit is contained in:
parent
537f9125cd
commit
f35458c2fc
|
@ -14,6 +14,8 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import requests
|
||||
import sys
|
||||
|
@ -52,7 +54,7 @@ class Command(BaseCommand):
|
|||
|
||||
for account in OIDCAccount.objects.filter(sub__in=unknown_uuids):
|
||||
if verbose:
|
||||
print 'disabling', account.user.email, account.user.ou
|
||||
print('disabling', account.user.email, account.user.ou)
|
||||
account.user.email = account.user.email + '.invalid'
|
||||
account.user.save()
|
||||
OIDCAccount.objects.filter(sub__in=unknown_uuids).delete()
|
||||
|
@ -95,7 +97,7 @@ class Command(BaseCommand):
|
|||
user = User.objects.get(email=cut_user_data['email'], ou=ou_gnm)
|
||||
except User.MultipleObjectsReturned:
|
||||
if verbose:
|
||||
print 'bad duplicated email', cut_user_data['email']
|
||||
print('bad duplicated email', cut_user_data['email'])
|
||||
continue
|
||||
except User.DoesNotExist:
|
||||
# uuid?
|
||||
|
@ -104,7 +106,7 @@ class Command(BaseCommand):
|
|||
except User.DoesNotExist:
|
||||
# at last, create new user
|
||||
if verbose:
|
||||
print 'creating', cut_user_data['email']
|
||||
print('creating', cut_user_data['email'])
|
||||
user = User()
|
||||
|
||||
if (user.uuid != cut_user_data['sub'] or
|
||||
|
@ -113,7 +115,7 @@ class Command(BaseCommand):
|
|||
user.first_name != cut_user_data['first_name'] or
|
||||
user.last_name != cut_user_data['last_name']):
|
||||
if verbose:
|
||||
print 'updating', user.email, '->', ou_gnm
|
||||
print('updating', user.email, '->', ou_gnm)
|
||||
# only touch user if there are changes
|
||||
user.uuid = cut_user_data['sub']
|
||||
user.ou = ou_gnm
|
||||
|
@ -126,4 +128,4 @@ class Command(BaseCommand):
|
|||
OIDCAccount.objects.get_or_create(provider=cut_agents, user=user, sub=cut_user_data['sub'])
|
||||
except django.db.utils.IntegrityError:
|
||||
if verbose:
|
||||
print 'oops duplicated email?', cut_user_data['email']
|
||||
print('oops duplicated email?', cut_user_data['email'])
|
||||
|
|
Reference in New Issue