Commit 4f9bf51f by Russell Jones Committed by benjaoming

Move to python3-style unicode everywhere str()

parent 2eb94b32
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals
import os import os
import sys import sys
import time import time
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -141,4 +142,4 @@ class Migration(SchemaMigration): ...@@ -141,4 +142,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['django_notify'] complete_apps = ['django_notify']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -101,4 +102,4 @@ class Migration(SchemaMigration): ...@@ -101,4 +102,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['django_notify'] complete_apps = ['django_notify']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -99,4 +100,4 @@ class Migration(SchemaMigration): ...@@ -99,4 +100,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['django_notify'] complete_apps = ['django_notify']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django_notify.decorators import json_view, login_required_ajax from django_notify.decorators import json_view, login_required_ajax
from django_notify import models from django_notify import models
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
...@@ -29,7 +29,7 @@ def get_notifications(request, latest_id=None, is_viewed=False, max_results=10): ...@@ -29,7 +29,7 @@ def get_notifications(request, latest_id=None, is_viewed=False, max_results=10):
'message': n.message, 'message': n.message,
'url': n.url, 'url': n.url,
'occurrences': n.occurrences, 'occurrences': n.occurrences,
'occurrences_msg': _(u'%d times') % n.occurrences, 'occurrences_msg': _('%d times') % n.occurrences,
'type': n.subscription.notification_type.key, 'type': n.subscription.notification_type.key,
'since': naturaltime(n.created)} for n in notifications[:max_results]]} 'since': naturaltime(n.created)} for n in notifications[:max_results]]}
...@@ -62,4 +62,4 @@ def mark_read(request, id_lte, notification_type_id=None, id_gte=None): ...@@ -62,4 +62,4 @@ def mark_read(request, id_lte, notification_type_id=None, id_gte=None):
notifications.update(is_viewed=True) notifications.update(is_viewed=True)
return {'success': True} return {'success': True}
\ No newline at end of file
from __future__ import print_function from __future__ import print_function, unicode_literals
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# django-wiki documentation build configuration file, created by # django-wiki documentation build configuration file, created by
...@@ -41,8 +41,8 @@ source_suffix = '.rst' ...@@ -41,8 +41,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'django-wiki' project = 'django-wiki'
copyright = u'2013, Benjamin Bach' copyright = '2013, Benjamin Bach'
path = os.path.join( path = os.path.join(
...@@ -206,8 +206,8 @@ latex_elements = { ...@@ -206,8 +206,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'django-wiki.tex', u'django-wiki Documentation', ('index', 'django-wiki.tex', 'django-wiki Documentation',
u'Benjamin Bach', 'manual'), 'Benjamin Bach', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
...@@ -236,8 +236,8 @@ latex_documents = [ ...@@ -236,8 +236,8 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'django-wiki', u'django-wiki Documentation', ('index', 'django-wiki', 'django-wiki Documentation',
[u'Benjamin Bach'], 1) ['Benjamin Bach'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
...@@ -250,8 +250,8 @@ man_pages = [ ...@@ -250,8 +250,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'django-wiki', u'django-wiki Documentation', ('index', 'django-wiki', 'django-wiki Documentation',
u'Benjamin Bach', 'django-wiki', 'One line description of project.', 'Benjamin Bach', 'django-wiki', 'One line description of project.',
'Miscellaneous'), 'Miscellaneous'),
] ]
......
from __future__ import unicode_literals
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline from django.contrib.contenttypes.generic import GenericTabularInline
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -69,7 +70,7 @@ class URLPathAdmin(MPTTModelAdmin): ...@@ -69,7 +70,7 @@ class URLPathAdmin(MPTTModelAdmin):
def get_created(self, instance): def get_created(self, instance):
return instance.article.created return instance.article.created
get_created.short_description = _(u'created') get_created.short_description = _('created')
admin.site.register(models.URLPath, URLPathAdmin) admin.site.register(models.URLPath, URLPathAdmin)
admin.site.register(models.Article, ArticleAdmin) admin.site.register(models.Article, ArticleAdmin)
......
from __future__ import unicode_literals
import os import os
import mimetypes import mimetypes
from datetime import datetime from datetime import datetime
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound, \ from django.http import HttpResponse, HttpResponseNotFound, \
HttpResponseForbidden, HttpResponseRedirect HttpResponseForbidden, HttpResponseRedirect
......
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import unicode_literals
"""Django model to DOT (Graphviz) converter """Django model to DOT (Graphviz) converter
by Antonio Cavedoni <antonio@cavedoni.org> by Antonio Cavedoni <antonio@cavedoni.org>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -262,4 +263,4 @@ class Migration(SchemaMigration): ...@@ -262,4 +263,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -143,4 +144,4 @@ class Migration(SchemaMigration): ...@@ -143,4 +144,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import DataMigration from south.v2 import DataMigration
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -141,4 +142,4 @@ class Migration(SchemaMigration): ...@@ -141,4 +142,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -206,4 +207,4 @@ class Migration(SchemaMigration): ...@@ -206,4 +207,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -198,4 +199,4 @@ class Migration(SchemaMigration): ...@@ -198,4 +199,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -279,4 +280,4 @@ class Migration(SchemaMigration): ...@@ -279,4 +280,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -229,4 +230,4 @@ class Migration(SchemaMigration): ...@@ -229,4 +230,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -219,4 +220,4 @@ class Migration(SchemaMigration): ...@@ -219,4 +220,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -225,4 +226,4 @@ class Migration(SchemaMigration): ...@@ -225,4 +226,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -261,4 +262,4 @@ class Migration(SchemaMigration): ...@@ -261,4 +262,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['wiki'] complete_apps = ['wiki']
\ No newline at end of file
from django.contrib import admin from django.contrib import admin
from __future__ import unicode_literals
from . import models from . import models
...@@ -16,4 +17,4 @@ class AttachmentAdmin(admin.ModelAdmin): ...@@ -16,4 +17,4 @@ class AttachmentAdmin(admin.ModelAdmin):
#def has_add_permission(self, request): #def has_add_permission(self, request):
# return False # return False
admin.site.register(models.Attachment, AttachmentAdmin) admin.site.register(models.Attachment, AttachmentAdmin)
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -159,4 +160,4 @@ class Migration(SchemaMigration): ...@@ -159,4 +160,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['attachments'] complete_apps = ['attachments']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages from django.contrib import messages
from django.db.models import Q from django.db.models import Q
from django.http import Http404, HttpResponseRedirect from django.http import Http404, HttpResponseRedirect
...@@ -45,9 +46,9 @@ class AttachmentView(ArticleMixin, FormView): ...@@ -45,9 +46,9 @@ class AttachmentView(ArticleMixin, FormView):
attachment_revision = form.save() attachment_revision = form.save()
if isinstance(attachment_revision, list): if isinstance(attachment_revision, list):
messages.success(self.request, _(u'Successfully added: %s') % (", ".join([ar.get_filename() for ar in attachment_revision]))) messages.success(self.request, _('Successfully added: %s') % (", ".join([ar.get_filename() for ar in attachment_revision])))
else: else:
messages.success(self.request, _(u'%s was successfully added.') % attachment_revision.get_filename()) messages.success(self.request, _('%s was successfully added.') % attachment_revision.get_filename())
return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id) return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id)
...@@ -119,9 +120,9 @@ class AttachmentReplaceView(ArticleMixin, FormView): ...@@ -119,9 +120,9 @@ class AttachmentReplaceView(ArticleMixin, FormView):
attachment_revision.save() attachment_revision.save()
self.attachment.current_revision = attachment_revision self.attachment.current_revision = attachment_revision
self.attachment.save() self.attachment.save()
messages.success(self.request, _(u'%s uploaded and replaces old attachment.') % attachment_revision.get_filename()) messages.success(self.request, _('%s uploaded and replaces old attachment.') % attachment_revision.get_filename())
except models.IllegalFileExtension as e: except models.IllegalFileExtension as e:
messages.error(self.request, _(u'Your file could not be saved: %s') % e) messages.error(self.request, _('Your file could not be saved: %s') % e)
return redirect("wiki:attachments_replace", attachment_id=self.attachment.id, return redirect("wiki:attachments_replace", attachment_id=self.attachment.id,
path=self.urlpath.path, article_id=self.article.id) path=self.urlpath.path, article_id=self.article.id)
...@@ -138,7 +139,7 @@ class AttachmentReplaceView(ArticleMixin, FormView): ...@@ -138,7 +139,7 @@ class AttachmentReplaceView(ArticleMixin, FormView):
def get_form(self, form_class): def get_form(self, form_class):
form = FormView.get_form(self, form_class) form = FormView.get_form(self, form_class)
form.fields['file'].help_text = _(u'Your new file will automatically be renamed to match the file already present. Files with different extensions are not allowed.') form.fields['file'].help_text = _('Your new file will automatically be renamed to match the file already present. Files with different extensions are not allowed.')
return form return form
def get_form_kwargs(self): def get_form_kwargs(self):
...@@ -201,7 +202,7 @@ class AttachmentChangeRevisionView(ArticleMixin, View): ...@@ -201,7 +202,7 @@ class AttachmentChangeRevisionView(ArticleMixin, View):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.attachment.current_revision = self.revision self.attachment.current_revision = self.revision
self.attachment.save() self.attachment.save()
messages.success(self.request, _(u'Current revision changed for %s.') % self.attachment.original_filename) messages.success(self.request, _('Current revision changed for %s.') % self.attachment.original_filename)
return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id) return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id)
...@@ -220,7 +221,7 @@ class AttachmentAddView(ArticleMixin, View): ...@@ -220,7 +221,7 @@ class AttachmentAddView(ArticleMixin, View):
if self.attachment.articles.filter(id=self.article.id): if self.attachment.articles.filter(id=self.article.id):
self.attachment.articles.add(self.article) self.attachment.articles.add(self.article)
self.attachment.save() self.attachment.save()
messages.success(self.request, _(u'Added a reference to "%(att)s" from "%(art)s".') % messages.success(self.request, _('Added a reference to "%(att)s" from "%(art)s".') %
{'att': self.attachment.original_filename, {'att': self.attachment.original_filename,
'art': self.article.current_revision.title}) 'art': self.article.current_revision.title})
return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id) return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id)
...@@ -250,10 +251,10 @@ class AttachmentDeleteView(ArticleMixin, FormView): ...@@ -250,10 +251,10 @@ class AttachmentDeleteView(ArticleMixin, FormView):
revision.save() revision.save()
self.attachment.current_revision = revision self.attachment.current_revision = revision
self.attachment.save() self.attachment.save()
messages.info(self.request, _(u'The file %s was deleted.') % self.attachment.original_filename) messages.info(self.request, _('The file %s was deleted.') % self.attachment.original_filename)
else: else:
self.attachment.articles.remove(self.article) self.attachment.articles.remove(self.article)
messages.info(self.request, _(u'This article is no longer related to the file %s.') % self.attachment.original_filename) messages.info(self.request, _('This article is no longer related to the file %s.') % self.attachment.original_filename)
return redirect("wiki:get", path=self.urlpath.path, article_id=self.article.id) return redirect("wiki:get", path=self.urlpath.path, article_id=self.article.id)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
""" """
Code modified from: Code modified from:
https://github.com/r0wb0t/markdown-urlize https://github.com/r0wb0t/markdown-urlize
...@@ -13,30 +14,30 @@ Positive examples: ...@@ -13,30 +14,30 @@ Positive examples:
>>> md = markdown.Markdown(extensions=['urlize']) >>> md = markdown.Markdown(extensions=['urlize'])
>>> md.convert('http://example.com/') >>> md.convert('http://example.com/')
u'<p><a href="http://example.com/">http://example.com/</a></p>' '<p><a href="http://example.com/">http://example.com/</a></p>'
>>> md.convert('go to http://example.com') >>> md.convert('go to http://example.com')
u'<p>go to <a href="http://example.com">http://example.com</a></p>' '<p>go to <a href="http://example.com">http://example.com</a></p>'
>>> md.convert('example.com') >>> md.convert('example.com')
u'<p><a href="http://example.com">example.com</a></p>' '<p><a href="http://example.com">example.com</a></p>'
>>> md.convert('example.net') >>> md.convert('example.net')
u'<p><a href="http://example.net">example.net</a></p>' '<p><a href="http://example.net">example.net</a></p>'
>>> md.convert('www.example.us') >>> md.convert('www.example.us')
u'<p><a href="http://www.example.us">www.example.us</a></p>' '<p><a href="http://www.example.us">www.example.us</a></p>'
>>> md.convert('(www.example.us/path/?name=val)') >>> md.convert('(www.example.us/path/?name=val)')
u'<p>(<a href="http://www.example.us/path/?name=val">www.example.us/path/?name=val</a>)</p>' '<p>(<a href="http://www.example.us/path/?name=val">www.example.us/path/?name=val</a>)</p>'
>>> md.convert('go to <http://example.com> now!') >>> md.convert('go to <http://example.com> now!')
u'<p>go to <a href="http://example.com">http://example.com</a> now!</p>' '<p>go to <a href="http://example.com">http://example.com</a> now!</p>'
Negative examples: Negative examples:
>>> md.convert('del.icio.us') >>> md.convert('del.icio.us')
u'<p>del.icio.us</p>' '<p>del.icio.us</p>'
""" """
...@@ -101,4 +102,4 @@ def makeExtension(configs=None): ...@@ -101,4 +102,4 @@ def makeExtension(configs=None):
if __name__ == "__main__": if __name__ == "__main__":
import doctest import doctest
doctest.testmod() doctest.testmod()
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
...@@ -133,4 +134,4 @@ class Migration(SchemaMigration): ...@@ -133,4 +134,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['notifications'] complete_apps = ['notifications']
\ No newline at end of file
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase from django.test import TestCase
from django.test.client import Client from django.test.client import Client
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import patterns, url, include from django.conf.urls import patterns, url, include
from wiki.conf import settings from wiki.conf import settings
......
from __future__ import unicode_literals
from django.views.generic.base import TemplateResponseMixin from django.views.generic.base import TemplateResponseMixin
from wiki.core.plugins import registry from wiki.core.plugins import registry
......
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