Commit b43d6228 authored by svilayphiou's avatar svilayphiou

changed all __unicode__ into __str__

parent 2911a6c9
......@@ -5,11 +5,11 @@ from django.contrib import admin
from etherpadlite.models import *
class PadAuthorAdmin(admin.ModelAdmin):
list_display = ('__unicode__',)
list_display = ('__str__',)
class PadAdmin(admin.ModelAdmin):
list_display = ('__unicode__',)
list_display = ('__str__',)
readonly_fields = ('name',)
exclude = ('display_name',)
......
......@@ -27,7 +27,7 @@ class PadServer(models.Model):
class Meta:
verbose_name = _('server')
def __unicode__(self):
def __str__(self):
return self.url
@property
......@@ -48,7 +48,7 @@ class PadGroup(models.Model):
class Meta:
verbose_name = _('group')
def __unicode__(self):
def __str__(self):
return self.group
@property
......@@ -131,14 +131,14 @@ class PadAuthor(models.Model):
return full_name
return self.user.username
def __unicode__(self):
def __str__(self):
return self.full_name_with_prefix()
def EtherMap(self):
epclient = EtherpadLiteClient(self.server.apikey, self.server.apiurl)
result = epclient.createAuthorIfNotExistsFor(
self.user.id.__str__(),
name=self.__unicode__()
name=self.__str__()
)
self.authorID = result['authorID']
return result
......@@ -171,7 +171,7 @@ class Pad(models.Model):
server = models.ForeignKey(PadServer, models.PROTECT)
group = models.ForeignKey(PadGroup, models.PROTECT)
def __unicode__(self):
def __str__(self):
return self.display_slug
def get_absolute_url(self):
......
......@@ -25,7 +25,7 @@ class PadServerTestCase(unittest.TestCase):
def testBasics(self):
self.assertTrue(isinstance(self.server, PadServer))
self.assertEqual(self.server.__unicode__(), TS['url'])
self.assertEqual(self.server.__str__(), TS['url'])
class PadGroupTestCase(unittest.TestCase):
......@@ -46,7 +46,7 @@ class PadGroupTestCase(unittest.TestCase):
def testBasics(self):
self.assertTrue(isinstance(self.padGroup, PadGroup))
self.assertEqual(self.padGroup.__unicode__(), self.group.__unicode__())
self.assertEqual(self.padGroup.__str__(), self.group.__str__())
def tearDown(self):
self.padGroup.delete()
......@@ -75,7 +75,7 @@ class PadAuthorTestCase(unittest.TestCase):
def testBasics(self):
self.assertTrue(isinstance(self.author, PadAuthor))
self.assertEqual(self.author.__unicode__(), self.user.__unicode__())
self.assertEqual(self.author.__str__(), self.user.__str__())
def tearDown(self):
self.padGroup.delete()
......@@ -109,7 +109,7 @@ class PadTestCase(unittest.TestCase):
def testBasics(self):
self.assertTrue(isinstance(self.pad, Pad))
self.assertEqual(self.pad.__unicode__(), self.pad.name)
self.assertEqual(self.pad.__str__(), self.pad.name)
def tearDown(self):
self.padGroup.delete()
......
......@@ -46,7 +46,7 @@ def padCreate(request, pk):
con = {
'form': form,
'pk': pk,
'title': _('Create pad in %(grp)s') % {'grp': group.__unicode__()}
'title': _('Create pad in %(grp)s') % {'grp': group.__str__()}
}
con.update(csrf(request))
return render_to_response(
......@@ -71,7 +71,7 @@ def padDelete(request, pk):
con = {
'action': '/etherpad/delete/' + pk + '/',
'question': _('Really delete this pad?'),
'title': _('Deleting %(pad)s') % {'pad': pad.__unicode__()}
'title': _('Deleting %(pad)s') % {'pad': pad.__str__()}
}
con.update(csrf(request))
return render_to_response(
......@@ -125,7 +125,7 @@ def groupDelete(request, pk):
def profile(request):
"""Display a user profile containing etherpad groups and associated pads
"""
name = request.user.__unicode__()
name = request.user.__str__()
try: # Retrieve the corresponding padauthor object
author = PadAuthor.objects.get(user=request.user)
......@@ -139,7 +139,7 @@ def profile(request):
groups = {}
for g in author.group.all():
groups[g.__unicode__()] = {
groups[g.__str__()] = {
'group': g,
'pads': Pad.objects.filter(group=g)
}
......@@ -174,7 +174,7 @@ def pad(request, pk):
'pad': pad,
'link': padLink,
'server': server,
'uname': author.user.__unicode__(),
'uname': author.user.__str__(),
'error': _('You are not allowed to view or edit this pad')
},
context_instance=RequestContext(request)
......@@ -200,7 +200,7 @@ def pad(request, pk):
'pad': pad,
'link': padLink,
'server': server,
'uname': author.user.__unicode__(),
'uname': author.user.__str__(),
'error': _('etherpad-lite session request returned:') +
' "' + e.reason + '"'
},
......@@ -215,7 +215,7 @@ def pad(request, pk):
'pad': pad,
'link': padLink,
'server': server,
'uname': author.user.__unicode__(),
'uname': author.user.__str__(),
'error': False
},
context_instance=RequestContext(request)
......
......@@ -50,7 +50,7 @@ def natural_join(val, cjn="and"):
if isinstance(object, str) or isinstance(object, unicode):
return object
try:
return object.__unicode__()
return object.__str__()
except AttributeError:
return repr(object)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment