Skip to content

Commit bd95ae7

Browse files
committed
moved DEFAULT_HTTP_PROTOCOL to a global variable and fixed another missed instance of http hardcoding
1 parent 850cb34 commit bd95ae7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

notification/feeds.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
from notification.models import Notice
1212
from notification.atomformat import Feed
1313

14+
1415
ITEMS_PER_FEED = getattr(settings, 'ITEMS_PER_FEED', 20)
16+
DEFAULT_HTTP_PROTOCOL = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
17+
1518

1619
class BaseNoticeFeed(Feed):
1720
def item_id(self, notification):
18-
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
1921
return "%s://%s%s" % (
20-
protocol,
22+
DEFAULT_HTTP_PROTOCOL,
2123
Site.objects.get_current().domain,
2224
notification.get_absolute_url(),
2325
)
@@ -45,9 +47,8 @@ def get_object(self, params):
4547
return get_object_or_404(User, username=params[0].lower())
4648

4749
def feed_id(self, user):
48-
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
4950
return "%s://%s%s" % (
50-
protocol,
51+
DEFAULT_HTTP_PROTOCOL,
5152
Site.objects.get_current().domain,
5253
reverse('notification_feed_for_user'),
5354
)
@@ -65,10 +66,11 @@ def feed_updated(self, user):
6566
return qs.latest('added').added
6667

6768
def feed_links(self, user):
68-
complete_url = "http://%s%s" % (
69-
Site.objects.get_current().domain,
70-
reverse('notification_notices'),
71-
)
69+
complete_url = "%s://%s%s" % (
70+
DEFAULT_HTTP_PROTOCOL,
71+
Site.objects.get_current().domain,
72+
reverse('notification_notices'),
73+
)
7274
return ({'href': complete_url},)
7375

7476
def items(self, user):

0 commit comments

Comments
 (0)