diff --git a/gracedb/api/v1/events/views.py b/gracedb/api/v1/events/views.py index 58fc413113b7e37a08e9b500cb17ac803190b736..9b7f8163358785731643383a52436cd95f375fa5 100644 --- a/gracedb/api/v1/events/views.py +++ b/gracedb/api/v1/events/views.py @@ -1281,7 +1281,7 @@ class EventLogTagDetail(InheritPermissionsAPIView): # client that the creation was sucessful when, in fact, the database # was unchanged. tag = eventlog.tags.filter(name=tagname)[0] - msg = "Log already has tag %s" % unicode(tag) + msg = "Log already has tag {0}".format(tag.name) return Response(msg,status=status.HTTP_409_CONFLICT) except: # Check authorization diff --git a/gracedb/events/templatetags/logtags.py b/gracedb/events/templatetags/logtags.py index 0e38cfac6741852f48510eeb051eba0816b01de0..d07c6188e6ad8b576959205bc400e6bcf3b35366 100644 --- a/gracedb/events/templatetags/logtags.py +++ b/gracedb/events/templatetags/logtags.py @@ -19,9 +19,6 @@ def getLogsForTag(event,name=None): # In either case, we want the template to just ignore it. return None -@register.filter("tagUnicode") -def tagUnicode(tag): - return unicode(tag); @register.filter("logsForTagHaveImage") def logsForTagAllHaveImages(event,name=None): diff --git a/gracedb/events/templatetags/scientific.py b/gracedb/events/templatetags/scientific.py index 0c3df5d80b4305362f2b4435dc72867d943b0428..ce1281520d5a0801dccaebe52690f43323b16c51 100644 --- a/gracedb/events/templatetags/scientific.py +++ b/gracedb/events/templatetags/scientific.py @@ -1,3 +1,4 @@ +from builtins import str from decimal import Decimal, InvalidOperation, ROUND_HALF_UP from django import template from django.utils.encoding import force_text @@ -61,7 +62,7 @@ def scientificformat(text): elif ( (d > Decimal('-100') and d < Decimal('-0.1')) or ( d > Decimal('0.1') and d < Decimal('100')) ) : # this is what the original floatformat() function does sign, digits, exponent = d.quantize(Decimal('.01'), ROUND_HALF_UP).as_tuple() - digits = [unicode(digit) for digit in reversed(digits)] + digits = [str(digit) for digit in reversed(digits)] while len(digits) <= abs(exponent): digits.append(u'0') digits.insert(-exponent, u'.') @@ -72,7 +73,7 @@ def scientificformat(text): # for very small and very large numbers sign, digits, exponent = d.as_tuple() exponent = d.adjusted() - digits = [unicode(digit) for digit in digits][:3] # limit to 2 decimal places + digits = [str(digit) for digit in digits][:3] # limit to 2 decimal places while len(digits) < 3: digits.append(u'0') digits.insert(1, u'.') diff --git a/gracedb/ligoauth/management/commands/update_user_accounts_from_ligo_ldap.py b/gracedb/ligoauth/management/commands/update_user_accounts_from_ligo_ldap.py index 38fd05eda3395f7ee0b00e6d1c9a2501c28a941f..2330e71a590c09e2d540ce0dcd10456bf783473f 100644 --- a/gracedb/ligoauth/management/commands/update_user_accounts_from_ligo_ldap.py +++ b/gracedb/ligoauth/management/commands/update_user_accounts_from_ligo_ldap.py @@ -1,3 +1,4 @@ +from builtins import str import datetime import ldap @@ -33,8 +34,8 @@ class LdapPersonResultProcessor(object): if self.ldap_connection is None: raise RuntimeError('LDAP connection not configured') self.user_data = { - 'first_name': unicode(self.ldap_result['givenName'][0], 'utf-8'), - 'last_name': unicode(self.ldap_result['sn'][0], 'utf-8'), + 'first_name': str(self.ldap_result['givenName'][0], 'utf-8'), + 'last_name': str(self.ldap_result['sn'][0], 'utf-8'), 'email': self.ldap_result['mail'][0], 'is_active': self.ldap_connection.lvc_group.ldap_name in self.ldap_result.get('isMemberOf', []), @@ -239,7 +240,7 @@ class LdapRobotResultProcessor(LdapPersonResultProcessor): if self.ldap_connection is None: raise RuntimeError('LDAP connection not configured') self.user_data = { - 'last_name': unicode(self.ldap_result['x-LIGO-TWikiName'][0], + 'last_name': str(self.ldap_result['x-LIGO-TWikiName'][0], 'utf-8'), 'email': self.ldap_result['mail'][0], 'is_active': self.ldap_connection.groups.get(