Commit b43d6228 authored by svilayphiou's avatar svilayphiou

changed all __unicode__ into __str__

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