Skip to content

Commit

Permalink
Merge pull request stephenmcd#47 from widder/master
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcd authored Oct 13, 2016
2 parents 1a8f4e0 + a026f64 commit 0773553
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions drum/links/management/commands/poll_rss.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import unicode_literals
from __future__ import print_function, unicode_literals

from datetime import datetime
from time import mktime
Expand Down Expand Up @@ -49,7 +49,7 @@ def handle(self, **options):
try:
link["link"] = self.follow_redirects(link["link"])
except Exception as e:
print "%s - skipping %s" % (e, link["link"])
print("%s - skipping %s" % (e, link["link"]))
continue
link["user_id"] = user_id
try:
Expand All @@ -58,7 +58,7 @@ def handle(self, **options):
obj = Link.objects.create(**link)
obj.rating.add(Rating(value=1, user_id=user_id),
bulk=False)
print "Added %s" % obj
print("Added %s" % obj)

def link_from_entry(self, entry):
"""
Expand Down Expand Up @@ -86,14 +86,14 @@ def entry_to_link_dict(self, entry):

def follow_redirects(self, link):
final = requests.get(link).url
print "followed %s to %s" % (link, final)
print("followed %s to %s" % (link, final))
return final

def follow_old(self):
for link in Link.objects.all():
try:
new_url = self.follow_redirects(link.link)
except Exception as e:
print "%s - skipping %s" % (e, link.link)
print("%s - skipping %s" % (e, link.link))
else:
Link.objects.filter(id=link.id).update(link=new_url)
4 changes: 2 additions & 2 deletions drum/links/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save, post_delete
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible

Expand Down Expand Up @@ -76,7 +76,7 @@ def __str__(self):


@receiver(post_save, sender=Rating)
@receiver(post_delete, sender=Rating)
@receiver(pre_delete, sender=Rating)
def karma(sender, **kwargs):
"""
Each time a rating is saved, check its value and modify the
Expand Down

0 comments on commit 0773553

Please sign in to comment.