Changeset - 387275c9d4b4
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 7 years ago 2014-07-14 17:10:23
bkuhn@ebb.org
GET object is accessible everywhere in BlogFeed.

This solution is likely a hack to ensure the GET object is regularly
accessible.
1 file changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
www/conservancy/feeds.py
Show inline comments
...
 
@@ -154,6 +154,9 @@ class BlogFeed(ConservancyFeedBase):
 
    get_absolute_url = '/feeds/blog/'
 

	
 
    def get_object(self, request):
 
        # This is a hack:  keep GET object handy so I always have it in all methods.
 
        if not hasattr(self, 'GET') and request and hasattr(request, 'GET'):
 
            self.GET = request.GET
 
        return request
 

	
 
    def title(self, obj):
...
 
@@ -223,7 +226,7 @@ class BlogFeed(ConservancyFeedBase):
 
        return item.author.formal_name
 

	
 
    def item_author_email(self, item):
 
        GET = self.get_object().GET
 
        GET = self.GET
 
        if not 'author' in GET:
 
            return "%s@sfconservancy.org" % item.author
 
        else:
...
 
@@ -241,7 +244,11 @@ class BlogFeed(ConservancyFeedBase):
 
        return item.pub_date
 

	
 
    def items(self, obj):
 
        GET = obj.GET
 
        # This is a hack:  keep GET object handy so I always have it in all methods.
 
        if not hasattr(self, 'GET') and request and hasattr(request, 'GET'):
 
            self.GET = request.GET
 

	
 
        GET = self.GET
 

	
 
        def OR_filter(field_name, subfield_name, objs):
 
            from django.db.models import Q
0 comments (0 inline, 0 general)