Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed some u'' prefixes and added unicode_literals.

  • Loading branch information...
commit 55ae2d9ca7d74c9273d5ffb30ba7c9698e4d8372 1 parent a49a59a
@timgraham timgraham authored
View
8 aggregator/management/commands/update_subscriptions.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import logging
from datetime import timedelta
@@ -26,17 +28,17 @@ def handle_noargs(self, **kwargs):
extra_feeds = subscribed_urls - feed_urls
for url in missing_feeds:
- logger.info(u'Subscribing to {0}'.format(url))
+ logger.info('Subscribing to {0}'.format(url))
Subscription.objects.subscribe(url, settings.PUSH_HUB)
for subscription in Subscription.objects.filter(topic__in=extra_feeds):
- logger.info(u'Unsubscribing from {0} ({1})'.format(
+ logger.info('Unsubscribing from {0} ({1})'.format(
subscription.pk, subscription.topic))
subscription.unsubscribe()
limit = timezone.now() + timedelta(days=2)
for subscription in Subscription.objects.exclude(
topic__in=extra_feeds).filter(lease_expiration__lte=limit):
- logger.info(u'Renewing subscription for {0} ({1})'.format(
+ logger.info('Renewing subscription for {0} ({1})'.format(
subscription.topic, subscription.pk))
subscription.subscribe()
View
6 aggregator/models.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import logging
import datetime
import feedparser
@@ -140,7 +142,7 @@ def feed_updated(sender, notification, **kwargs):
log.error("Feed ID %s has an entry ('%s') without a link or guid. Skipping.", feed.id, title)
link = getattr(entry, "link", guid)
- content = u''
+ content = ''
if hasattr(entry, "summary"):
content = entry.summary
@@ -150,7 +152,7 @@ def feed_updated(sender, notification, **kwargs):
# 'content' takes precedence on anything else. 'summary' and
# 'description' are usually truncated so it's safe to overwrite them
if hasattr(entry, "content"):
- content = u''
+ content = ''
for item in entry.content:
content += item.value
View
10 blog/models.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import datetime
from docutils.core import publish_parts
@@ -23,8 +25,8 @@ def active(self):
return super(EntryManager, self).get_queryset().filter(is_active=True)
CONTENT_FORMAT_CHOICES = (
- (u'reST', u'reStructuredText'),
- (u'html', u'Raw HTML'),
+ ('reST', 'reStructuredText'),
+ ('html', 'Raw HTML'),
)
@@ -75,10 +77,10 @@ def is_published(self):
is_published.boolean = True
def save(self, *args, **kwargs):
- if self.content_format == u'html':
+ if self.content_format == 'html':
self.summary_html = self.summary
self.body_html = self.body
- elif self.content_format == u'reST':
+ elif self.content_format == 'reST':
self.summary_html = publish_parts(source=smart_str(self.summary),
writer_name="html",
settings_overrides=BLOG_DOCUTILS_SETTINGS)['fragment']
View
2  cla/models.py
@@ -1,6 +1,8 @@
"""
Track signed CLAs.
"""
+from __future__ import unicode_literals
+
from django.db import models
from django.contrib.auth.models import User
View
2  contact/forms.py
@@ -13,7 +13,7 @@
class BaseContactForm(ContactForm):
- message_subject = forms.CharField(max_length=100, widget=forms.TextInput(attrs=attrs), label=u'Message subject')
+ message_subject = forms.CharField(max_length=100, widget=forms.TextInput(attrs=attrs), label='Message subject')
def subject(self):
return "[Contact form] " + self.cleaned_data["message_subject"]
View
2  docs/models.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.conf import settings
from django.core.cache import cache
from django.db import models
View
4 docs/search_indexes.py
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
import json
from django.utils.html import strip_tags
@@ -25,6 +27,6 @@ def prepare_text(self, obj):
docpath = utils.get_doc_path(root, obj.path)
with open(docpath) as fp:
doc = json.load(fp)
- return strip_tags(doc['body']).replace(u'', '')
+ return strip_tags(doc['body']).replace('', '')
haystack.site.register(Document, DocumentIndex)
Please sign in to comment.
Something went wrong with that request. Please try again.