Skip to content

Commit

Permalink
moved DEFAULT_HTTP_PROTOCOL to a global variable and fixed another mi…
Browse files Browse the repository at this point in the history
…ssed instance of http hardcoding
  • Loading branch information
brosner committed Oct 21, 2009
1 parent 850cb34 commit bd95ae7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions notification/feeds.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from notification.models import Notice from notification.models import Notice
from notification.atomformat import Feed from notification.atomformat import Feed



ITEMS_PER_FEED = getattr(settings, 'ITEMS_PER_FEED', 20) ITEMS_PER_FEED = getattr(settings, 'ITEMS_PER_FEED', 20)
DEFAULT_HTTP_PROTOCOL = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")



class BaseNoticeFeed(Feed): class BaseNoticeFeed(Feed):
def item_id(self, notification): def item_id(self, notification):
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
return "%s://%s%s" % ( return "%s://%s%s" % (
protocol, DEFAULT_HTTP_PROTOCOL,
Site.objects.get_current().domain, Site.objects.get_current().domain,
notification.get_absolute_url(), notification.get_absolute_url(),
) )
Expand Down Expand Up @@ -45,9 +47,8 @@ def get_object(self, params):
return get_object_or_404(User, username=params[0].lower()) return get_object_or_404(User, username=params[0].lower())


def feed_id(self, user): def feed_id(self, user):
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
return "%s://%s%s" % ( return "%s://%s%s" % (
protocol, DEFAULT_HTTP_PROTOCOL,
Site.objects.get_current().domain, Site.objects.get_current().domain,
reverse('notification_feed_for_user'), reverse('notification_feed_for_user'),
) )
Expand All @@ -65,10 +66,11 @@ def feed_updated(self, user):
return qs.latest('added').added return qs.latest('added').added


def feed_links(self, user): def feed_links(self, user):
complete_url = "http://%s%s" % ( complete_url = "%s://%s%s" % (
Site.objects.get_current().domain, DEFAULT_HTTP_PROTOCOL,
reverse('notification_notices'), Site.objects.get_current().domain,
) reverse('notification_notices'),
)
return ({'href': complete_url},) return ({'href': complete_url},)


def items(self, user): def items(self, user):
Expand Down

0 comments on commit bd95ae7

Please sign in to comment.