diff --git a/.gitignore b/.gitignore
index 7e99e36..7f987b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
-*.pyc
\ No newline at end of file
+*.pyc
+build/
+dist/
+django_articles.*/
diff --git a/articles/__init__.py b/articles/__init__.py
index bece0f0..0652866 100644
--- a/articles/__init__.py
+++ b/articles/__init__.py
@@ -1,9 +1,3 @@
__version__ = '2.4.2'
-from articles.directives import *
-try:
- import listeners
-except ImportError:
- # this happens when setup.py is grabbing __version__; nothing to worry
- # about
- pass
+from .directives import *
diff --git a/articles/admin.py b/articles/admin.py
index 751dcbb..372b142 100644
--- a/articles/admin.py
+++ b/articles/admin.py
@@ -3,8 +3,8 @@
from django.contrib import admin
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
-from forms import ArticleAdminForm
-from models import Tag, Article, ArticleStatus, Attachment
+from .forms import ArticleAdminForm
+from .models import Tag, Article, ArticleStatus, Attachment
log = logging.getLogger('articles.admin')
diff --git a/articles/directives.py b/articles/directives.py
index bdecbea..696fc5e 100644
--- a/articles/directives.py
+++ b/articles/directives.py
@@ -34,6 +34,8 @@
:license: BSD, see LICENSE for more details.
"""
+from __future__ import unicode_literals
+
# Options
# ~~~~~~~
@@ -66,7 +68,7 @@ def pygments_directive(name, arguments, options, content, lineno,
lexer = TextLexer()
# take an arbitrary option if more than one is given
formatter = options and VARIANTS[options.keys()[0]] or DEFAULT
- parsed = highlight(u'\n'.join(content), lexer, formatter)
+ parsed = highlight('\n'.join(content), lexer, formatter)
parsed = '
Meta
{% trans 'Published' %}: {{ article.publish_date|naturalday }}
-
{% trans 'Author' %}: {{ article.author.get_name }}
+
{% trans 'Author' %}: {{ article.author.get_name }}
{% trans 'Comments' %}:
diff --git a/articles/templates/articles/article_detail.html b/articles/templates/articles/article_detail.html
index fbdcb74..02da8e4 100644
--- a/articles/templates/articles/article_detail.html
+++ b/articles/templates/articles/article_detail.html
@@ -1,5 +1,6 @@
{% extends 'articles/base.html' %}
{% load i18n %}
+{% load url from future %}
{% block title %}{% trans article.title %}{% endblock %}
{% block meta-keywords %}{{ article.keywords|escape }}{% endblock %}
@@ -7,8 +8,8 @@
{% block extra-head %}
{{ block.super }}
{% for tag in article.tags.all %}
-
-
{% endfor %}
+
+
{% endfor %}
{% endblock %}
{% block content %}
diff --git a/articles/templates/articles/base.html b/articles/templates/articles/base.html
index 91efc5e..3cadd15 100644
--- a/articles/templates/articles/base.html
+++ b/articles/templates/articles/base.html
@@ -1,10 +1,11 @@
{% extends 'base.html' %}
+{% load url from future %}
{% load article_tags i18n %}
{% block extra-head %}
{{ block.super }}
-
-
+
+
{% endblock %}
{% block content %}
@@ -17,7 +18,7 @@
{% trans 'Article Archives' %}
{{ year.0 }}
diff --git a/articles/templates/articles/display_tag.html b/articles/templates/articles/display_tag.html
index ef61c9a..663cbfb 100644
--- a/articles/templates/articles/display_tag.html
+++ b/articles/templates/articles/display_tag.html
@@ -1,11 +1,12 @@
{% extends 'articles/base.html' %}
+{% load url from future %}
{% load i18n %}
{% block title %}{% trans 'Articles Tagged' %}: {{ tag.name }}{% endblock %}
{% block extra-head %}
{{ block.super }}
-
-
+
+
{% endblock %}
{% block articles-content %}
diff --git a/articles/templatetags/article_tags.py b/articles/templatetags/article_tags.py
index b09e29f..9ac20f2 100644
--- a/articles/templatetags/article_tags.py
+++ b/articles/templatetags/article_tags.py
@@ -127,7 +127,7 @@ def render(self, context):
pub = article.publish_date
# see if we already have an article in this year
- if not archives.has_key(pub.year):
+ if not pub.year in archives:
# if not, initialize a dict for the year
archives[pub.year] = {}
diff --git a/articles/tests.py b/articles/tests.py
index a325326..01afa84 100644
--- a/articles/tests.py
+++ b/articles/tests.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
from datetime import datetime, timedelta
from django.contrib.auth.models import User, Permission
@@ -7,7 +9,7 @@
from django.test import TestCase
from django.test.client import Client
-from models import Article, ArticleStatus, Tag, get_name, MARKUP_HTML, MARKUP_MARKDOWN, MARKUP_REST, MARKUP_TEXTILE
+from .models import Article, ArticleStatus, Tag, get_name, MARKUP_HTML, MARKUP_MARKDOWN, MARKUP_REST, MARKUP_TEXTILE
class ArticleUtilMixin(object):
@@ -42,7 +44,7 @@ def setUp(self):
def test_unicode_tag(self):
"""Unicode characters in tags (issue #10)"""
- name = u'Căutare avansată'
+ name = 'Căutare avansată'
t = Tag.objects.create(name=name)
self.assertEqual(t.slug, 'cutare-avansat')
@@ -75,10 +77,10 @@ def setUp(self):
def test_instantiation(self):
_as = ArticleStatus(name='Fake', ordering=5, is_live=True)
- self.assertEqual(unicode(_as), u'Fake (live)')
+ self.assertEqual(unicode(_as), 'Fake (live)')
_as.is_live = False
- self.assertEqual(unicode(_as), u'Fake')
+ self.assertEqual(unicode(_as), 'Fake')
class ArticleTestCase(TestCase, ArticleUtilMixin):
fixtures = ['users']
@@ -170,7 +172,7 @@ def test_markup_markdown(self):
regular paragraph.''', markup=MARKUP_MARKDOWN)
a.do_render_markup()
- print a.rendered_content
+ print(a.rendered_content)
def test_markup_rest(self):
"""Makes sure reStructuredText works"""
@@ -186,7 +188,7 @@ def test_markup_rest(self):
regular paragraph.''', markup=MARKUP_REST)
a.do_render_markup()
- print a.rendered_content
+ print(a.rendered_content)
def test_markup_textile(self):
"""Makes sure textile works"""
@@ -202,7 +204,7 @@ def test_markup_textile(self):
regular paragraph.''', markup=MARKUP_TEXTILE)
a.do_render_markup()
- print a.rendered_content
+ print(a.rendered_content)
def test_markup_html(self):
"""Makes sure HTML works (derp)"""
diff --git a/articles/urls.py b/articles/urls.py
index 564c7ea..486db88 100644
--- a/articles/urls.py
+++ b/articles/urls.py
@@ -1,7 +1,7 @@
from django.conf.urls.defaults import *
-from articles import views
-from articles.feeds import TagFeed, LatestEntries, TagFeedAtom, LatestEntriesAtom
+from . import views
+from .feeds import TagFeed, LatestEntries, TagFeedAtom, LatestEntriesAtom
tag_rss = TagFeed()
latest_rss = LatestEntries()
diff --git a/articles/views.py b/articles/views.py
index 7184c17..de9378a 100644
--- a/articles/views.py
+++ b/articles/views.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import logging
from django.conf import settings
@@ -8,7 +10,7 @@
from django.http import HttpResponsePermanentRedirect, Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
-from articles.models import Article, Tag
+from .models import Article, Tag
from datetime import datetime
ARTICLE_PAGINATION = getattr(settings, 'ARTICLE_PAGINATION', 20)
@@ -106,7 +108,7 @@ def ajax_tag_autocomplete(request):
return response
tags = list(Tag.objects.filter(name__istartswith=q)[:10])
- response = HttpResponse(u'\n'.join(tag.name for tag in tags))
+ response = HttpResponse('\n'.join(tag.name for tag in tags))
cache.set(key, response, 300)
return response