diff options
-rw-r--r-- | askbot/conf/social_sharing.py | 11 | ||||
-rw-r--r-- | askbot/doc/source/changelog.rst | 1 | ||||
-rw-r--r-- | askbot/feed.py | 6 | ||||
-rw-r--r-- | askbot/templates/main_page/tab_bar.html | 2 | ||||
-rw-r--r-- | askbot/templates/question/sidebar.html | 2 |
5 files changed, 20 insertions, 2 deletions
diff --git a/askbot/conf/social_sharing.py b/askbot/conf/social_sharing.py index 9a0f8ad4..c7c29151 100644 --- a/askbot/conf/social_sharing.py +++ b/askbot/conf/social_sharing.py @@ -8,13 +8,22 @@ from django.utils.translation import ugettext as _ SOCIAL_SHARING = ConfigurationGroup( 'SOCIAL_SHARING', - _('Sharing content on social networks'), + _('Content sharing'), super_group = EXTERNAL_SERVICES ) settings.register( BooleanValue( SOCIAL_SHARING, + 'RSS_ENABLED', + default=True, + description=_('Check to enable RSS feeds') + ) +) + +settings.register( + BooleanValue( + SOCIAL_SHARING, 'ENABLE_SHARING_TWITTER', default=True, description=_('Check to enable sharing of questions on Twitter') diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index f5714421..0fff72a1 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,7 @@ Changes in Askbot Development version ------------------- +* Added option to enable/disable rss feeds (Evgeny) * Added minimum reputation to insert links and hotlinked images (Evgeny) * Added minimum reputation to suggest links as plain text (Evgeny) * Added support of Haystack for search (Adolfo) diff --git a/askbot/feed.py b/askbot/feed.py index 285bb452..ac3dcdd0 100644 --- a/askbot/feed.py +++ b/askbot/feed.py @@ -18,6 +18,7 @@ from django.contrib.syndication.feeds import Feed from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext as _ from django.core.exceptions import ObjectDoesNotExist +from django.http import Http404 from askbot.models import Post from askbot.conf import settings as askbot_settings @@ -37,6 +38,8 @@ class RssIndividualQuestionFeed(Feed): return askbot_settings.APP_DESCRIPTION def get_object(self, bits): + if askbot_settings.RSS_ENABLED is False: + raise Http404 if len(bits) != 1: raise ObjectDoesNotExist return Post.objects.get_questions().get(id__exact = bits[0]) @@ -144,6 +147,8 @@ class RssLastestQuestionsFeed(Feed): def items(self, item): """get questions for the feed """ + if askbot_settings.RSS_ENABLED is False: + raise Http404 #initial filtering qs = Post.objects.get_questions().filter(deleted=False) @@ -165,7 +170,6 @@ class RssLastestQuestionsFeed(Feed): return qs.order_by('-thread__last_activity_at')[:30] - def main(): """main function for use as a script """ diff --git a/askbot/templates/main_page/tab_bar.html b/askbot/templates/main_page/tab_bar.html index 17ab810e..37f63012 100644 --- a/askbot/templates/main_page/tab_bar.html +++ b/askbot/templates/main_page/tab_bar.html @@ -1,6 +1,7 @@ {% import "macros.html" as macros %} {% load extra_filters_jinja %} {% cache 0 "scope_sort_tabs" search_tags request.user author_name scope sort query context.page language_code %} +{% if settings.RSS_ENABLED %} <a class="rss" {% if feed_url %} href="{{feed_url}}" @@ -10,6 +11,7 @@ title="{% trans %}subscribe to the questions feed{% endtrans %}" >{% trans %}RSS{% endtrans %} </a> +{% endif %} <div class="tabBar"> <div id="sort_tabs" class="tabsA"> <span class="label">{% trans %}Sort by »{% endtrans %}</span> diff --git a/askbot/templates/question/sidebar.html b/askbot/templates/question/sidebar.html index 4d431ef2..905ce781 100644 --- a/askbot/templates/question/sidebar.html +++ b/askbot/templates/question/sidebar.html @@ -39,12 +39,14 @@ <input type="checkbox" id="question-subscribe-sidebar"/> <label for="question-subscribe-sidebar">{% trans %}<strong>Here</strong> (once you log in) you will be able to sign up for the periodic email updates about this question.{% endtrans %}</label> {%endif%} + {% if settings.RSS_ENABLED %} <p class="rss"> <a href="{{settings.APP_URL}}/feeds/question/{{ question.id }}" title="{% trans %}subscribe to this question rss feed{% endtrans %}" >{% trans %}subscribe to rss feed{% endtrans %}</a> </p> + {% endif %} </div> </div> |