diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-09-26 23:16:37 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-09-26 23:16:37 -0400 |
commit | b3afad48e7b8ef63bcf24aa7ff5c8c7a0a92d197 (patch) | |
tree | e18a4ea9eff3f7baeec278fff829b555920f37ec | |
parent | 35954df3196e46653b6b66ea80fe95dfacc7484d (diff) | |
download | askbot-b3afad48e7b8ef63bcf24aa7ff5c8c7a0a92d197.tar.gz askbot-b3afad48e7b8ef63bcf24aa7ff5c8c7a0a92d197.tar.bz2 askbot-b3afad48e7b8ef63bcf24aa7ff5c8c7a0a92d197.zip |
questions page works on jinja, without translations yet
-rw-r--r-- | askbot/conf/site_settings.py | 16 | ||||
-rw-r--r-- | askbot/models/question.py | 8 | ||||
-rw-r--r-- | askbot/setup_templates/settings.py | 1 | ||||
-rw-r--r-- | askbot/skins/default/templates/base.jinja.html | 8 | ||||
-rw-r--r-- | askbot/skins/default/templates/footer.jinja.html | 2 | ||||
-rw-r--r-- | askbot/skins/default/templates/header.jinja.html | 4 | ||||
-rw-r--r-- | askbot/skins/default/templates/input_bar.jinja.html | 10 | ||||
-rw-r--r-- | askbot/skins/default/templates/macros.html | 40 | ||||
-rw-r--r-- | askbot/skins/default/templates/questions.jinja.html | 8 | ||||
-rw-r--r-- | askbot/skins/default/templates/tag_selector.jinja.html | 6 | ||||
-rw-r--r-- | askbot/skins/loaders.py | 3 | ||||
-rw-r--r-- | askbot/templatetags/extra_filters.py | 25 | ||||
-rw-r--r-- | askbot/templatetags/extra_filters_jinja.py | 214 | ||||
-rw-r--r-- | askbot/templatetags/extra_tags.py | 53 | ||||
-rw-r--r-- | askbot/utils/slug.py | 4 | ||||
-rw-r--r-- | askbot/views/readers.py | 6 |
16 files changed, 346 insertions, 62 deletions
diff --git a/askbot/conf/site_settings.py b/askbot/conf/site_settings.py index a206144f..9992b1e3 100644 --- a/askbot/conf/site_settings.py +++ b/askbot/conf/site_settings.py @@ -102,19 +102,3 @@ settings.register( ) ) ) - -settings.register( - livesettings.BooleanValue( - QA_SITE_SETTINGS, - 'USE_ASCII_ONLY_SLUGS', - description=_( - 'Use slugs made only of ASCII characters ' - 'in the page urls' - ), - help_text=_('Slugs are human-readable parts of the url ' - 'consisting of the page keywords, that are ' - 'typically composed from the page title.' - ), - default = True - ) -) diff --git a/askbot/models/question.py b/askbot/models/question.py index c450eed9..993463b0 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -180,6 +180,14 @@ class QuestionManager(models.Manager): #relevance will be ignored here qs = qs.order_by(orderby) qs = qs.distinct() + qs = qs.select_related( + 'last_activity_by__id', + 'last_activity_by__username' + 'last_activity_by__reputation' + 'last_activity_by__gold' + 'last_activity_by__silver' + 'last_activity_by__bronze' + ) return qs, meta_data #todo: this function is similar to get_response_receivers diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 491d3832..81e5a991 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -203,3 +203,4 @@ LOGIN_URL = '/%s%s%s' % (ASKBOT_URL,_('account/'),_('signin/')) #note - it is important that upload dir url is NOT translated!!! #also, this url must not have the leading slash ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/') +ALLOW_UNICODE_SLUGS = False diff --git a/askbot/skins/default/templates/base.jinja.html b/askbot/skins/default/templates/base.jinja.html index 3c28fb45..3051f1f7 100644 --- a/askbot/skins/default/templates/base.jinja.html +++ b/askbot/skins/default/templates/base.jinja.html @@ -56,7 +56,7 @@ </script> {% endif %} {% if active_tab != "tags" and active_tab != "users" %} - {% comment %}start asking question with title from search query{% endcomment %} + {# start asking question with title from search query #} <script type="text/javascript"> $(document).ready(function(){ $('#nav_ask').click( @@ -69,7 +69,7 @@ ); }); </script> - {% comment %}focus input on the search bar{% endcomment %} + {# focus input on the search bar endcomment #} <script type="text/javascript"> $(document).ready(function() { {% if active_tab != "ask" %} @@ -89,13 +89,11 @@ <body> {% endif %} <div class="notify" style="display:none"> - {% autoescape off %} {% if user_messages %} {% for message in user_messages %} <p class="darkred">{{ message }}</p> {% endfor %} {% endif %} - {% endautoescape %} <a id="close-notify" onclick="notify.close(true)">×</a> </div> {% include "header.jinja.html" %} @@ -118,7 +116,7 @@ </div> <div class="spacer3"></div> </div> - {% include "footer.html" %} + {% include "footer.jinja.html" %} {% block endjs %} {% endblock %} </body> diff --git a/askbot/skins/default/templates/footer.jinja.html b/askbot/skins/default/templates/footer.jinja.html index 9b6130f8..5ed39eb3 100644 --- a/askbot/skins/default/templates/footer.jinja.html +++ b/askbot/skins/default/templates/footer.jinja.html @@ -25,7 +25,7 @@ </div> <div id="licenseLogo"> <a href="http://creativecommons.org/licenses/by/3.0/"> - <img src="{% media "/images/cc-wiki.png" %}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /> + <img src="{{"/images/cc-wiki.png"|media }}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /> </a> </div> </div> diff --git a/askbot/skins/default/templates/header.jinja.html b/askbot/skins/default/templates/header.jinja.html index 2152fea9..7c2da527 100644 --- a/askbot/skins/default/templates/header.jinja.html +++ b/askbot/skins/default/templates/header.jinja.html @@ -1,5 +1,5 @@ <!-- template header.jinja.html --> -{% import "macros.html" %} +{% import "macros.html" as macros %} <div id="roof"> <div id="navBar"> <div id="top"> @@ -35,7 +35,7 @@ <td id="logoContainer"> <div id="logo"> <a href="{% url questions %}?start_over=true"><img - src="{% media settings.SITE_LOGO_URL %}" + src="{{ settings.SITE_LOGO_URL|media }}" title="{% trans %}back to home page{% endtrans %}" alt="{% trans site=settings.APP_SHORT_NAME %}{{site}} logo{% endtrans %}"/></a> </div> diff --git a/askbot/skins/default/templates/input_bar.jinja.html b/askbot/skins/default/templates/input_bar.jinja.html index 886707ff..e9f759ba 100644 --- a/askbot/skins/default/templates/input_bar.jinja.html +++ b/askbot/skins/default/templates/input_bar.jinja.html @@ -1,7 +1,7 @@ {% if active_tab != "ask" %} {% spaceless %} <div id="searchBar"> - {% comment %}url action depends on which tab is active{% endcomment %} + {# url action depends on which tab is active #} <form {% if active_tab == "tags" or active_tab == "users" %} action="{% url search %}" @@ -9,7 +9,7 @@ action="{% url questions %}" {% endif %} method="get"> - {% comment %} class was searchInput {% endcomment %} + {# class was searchInput #} <input {% if query %} class="searchInputCancelable" @@ -21,15 +21,15 @@ value="{{ query|default_if_none('') }}" name="query" id="keywords"/> - {% if query %}{% comment %}query is only defined by questions view{% endcomment %} + {% if query %}{# query is only defined by questions view #} <input type="button" value="x" name="reset_query" - {% comment %}todo - make sure it works on Enter keypress{% endcomment %} + {# todo - make sure it works on Enter keypress #} onclick="window.location.href='{% url questions %}?reset_query=true'" class="cancelSearchBtn"/> {% endif %} - <input type="submit" value="{% trans "search" %}" name="search" class="searchBtn" /> + <input type="submit" value="{% trans %}search{% endtrans %}" name="search" class="searchBtn" /> {% if active_tab == "tags" %} <input type="hidden" name="t" value="tag"/> {% else %} diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index 8ef9049b..31db81d8 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -78,3 +78,43 @@ {% endif %} {% endspaceless %} {%- endmacro -%} + +{%- macro pagesize_switch(p) -%}{# p is paginator context #} +{% spaceless %} +{% if p.is_paginated %} + <div class="paginator"> + <span class="text">{% trans %}posts per page{% endtrans %}</span> + {% if p.page_size == 10 %} + <span class="curr">10</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=10">10</a></span> + {% endif %} + + {% if p.page_size == 30 %} + <span class="curr">30</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=30">30</a></span> + {% endif %} + + {% if p.page_size == 50 %} + <span class="curr">50</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=50">50</a></span> + {% endif %} + </div> +{% endif %} +{% endspaceless %} +{%- endmacro -%} + +{%- macro gravatar(user, size) -%} +{% spaceless %} +<a style="text-decoration:none" + href="{{user.get_absolute_url()}}" +><img class="gravatar" + width="{{size}}" height="{{size}}" + src="http://www.gravatar.com/avatar/{{user.gravatar}}s?s={{size}}&d=identicon&r=PG" + title="{{user.username}}" + alt="{% trans username=user.username %}{{username}} gravatar image{% endtrans %}" +/></a> +{% endspaceless %} +{%- endmacro -%} diff --git a/askbot/skins/default/templates/questions.jinja.html b/askbot/skins/default/templates/questions.jinja.html index 9e0ce324..921c05e1 100644 --- a/askbot/skins/default/templates/questions.jinja.html +++ b/askbot/skins/default/templates/questions.jinja.html @@ -205,11 +205,11 @@ <h2><a title="{{question.summary}}" href="{{ question.get_absolute_url() }}">{{question.title}}</a></h2> <div class="userinfo"> <span class="relativetime" title="{{question.last_activity_at}}">{{ question.last_activity_at|diff_date }}</span> - {{question.last_activity_by.get_profile_link()}} + <a href="{% url user_profile question.last_activity_by.id, question.last_activity_by.username|slugify %}">{{question.last_activity_by.username}}</a> {{macros.user_score_and_badge_summary(question.last_activity_by)}} </div> <div class="tags"> - {% for tag in question.tagname_list %} + {% for tag in question.tagname_list() %} <a href="{% url questions %}?tags={{tag|urlencode}}" title="{% trans %}see questions tagged '{{ tag }}'{% endtrans %}" rel="tag">{{ tag }}</a> {% endfor %} </div> @@ -262,7 +262,7 @@ {% block tail %} {% if questions_count > 10 %}{# todo: remove magic number #} <div id="pager" class="pager">{{ macros.paginator(context|setup_paginator) }}</div> - <div class="pagesize">{{ macros.page_size_switch(context) }}</div> + <div class="pagesize">{{ macros.pagesize_switch(context) }}</div> {% endif %} {% endblock %} @@ -273,7 +273,7 @@ <h3 class="subtitle">{% trans %}Contributors{% endtrans %}</h3> {% spaceless %} {% for person in contributors %} - {% gravatar person 48 %} + {{ macros.gravatar(person,48) }} {% endfor %} {% endspaceless %} </div> diff --git a/askbot/skins/default/templates/tag_selector.jinja.html b/askbot/skins/default/templates/tag_selector.jinja.html index ad0942f8..6f6b8dc6 100644 --- a/askbot/skins/default/templates/tag_selector.jinja.html +++ b/askbot/skins/default/templates/tag_selector.jinja.html @@ -1,4 +1,4 @@ -{% comment %}todo - maybe disable navigation from ignored tags here when "hide" is on - with js?{%endcomment%} +{# todo - maybe disable navigation from ignored tags here when "hide" is on - with js? #} <div id="tagSelector" class="boxC"> <h3 class="subtitle">{% trans %}Interesting tags{% endtrans %}</h3> <div class="tags interesting marked-tags"> @@ -23,10 +23,10 @@ {% spaceless %} <span class="deletable-tag" id="ignored-tag-{{tag_name}}"> <a rel="tag" - title="{% trans %}see questions tagged '{{ tag_name }}'{% endbtrans %}" + title="{% trans %}see questions tagged '{{ tag_name }}'{% endtrans %}" href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}}</a> <img class="delete-icon" - src="{{'/images/close-small-dark.png|media{% endtrans %}" + src="{{'/images/close-small-dark.png'|media}}" title="{% trans %}remove '{{tag_name}}' from the list of ignored tags{% endtrans %}"/> </span> {% endspaceless %} diff --git a/askbot/skins/loaders.py b/askbot/skins/loaders.py index 59114c5a..fa6f1a7d 100644 --- a/askbot/skins/loaders.py +++ b/askbot/skins/loaders.py @@ -52,4 +52,5 @@ class SkinEnvironment(CoffinEnvironment): loaders.append(jinja_loaders.FileSystemLoader(template_dirs)) return loaders -ENV = SkinEnvironment(extensions=['jinja2.ext.i18n']) +ENV = SkinEnvironment(autoescape=False, extensions=['jinja2.ext.i18n']) +ENV.install_null_translations() diff --git a/askbot/templatetags/extra_filters.py b/askbot/templatetags/extra_filters.py index c09812ae..c3fde996 100644 --- a/askbot/templatetags/extra_filters.py +++ b/askbot/templatetags/extra_filters.py @@ -1,5 +1,9 @@ +import logging from django import template from django.core import exceptions as django_exceptions +from django.utils.translation import ugettext as _ +from django.contrib.humanize.templatetags import humanize +from django.template import defaultfilters from askbot import exceptions as askbot_exceptions from askbot import auth from askbot import models @@ -7,31 +11,16 @@ from askbot.deps.grapefruit import Color from askbot.conf import settings as askbot_settings from askbot.skins import utils as skin_utils from askbot.utils import functions -from django.utils.translation import ugettext as _ -import logging +from askbot.utils.slug import slugify register = template.Library() -@template.defaultfilters.stringfilter @register.filter def collapse(input): + input = str(input) return ' '.join(input.split()) -@template.defaultfilters.stringfilter -@register.filter -def media(url): - """media filter - same as media tag, but - to be used as a filter in jinja templates - like so {{'/some/url.gif'|media}} - """ - if url: - return skin_utils.get_media_url(url) - else: - return '' - -diff_date = register.filter(functions.diff_date) - -setup_paginator = register.filter(function.setup_paginator) +slugify = register.filter(slugify) def make_template_filter_from_permission_assertion( assertion_name = None, diff --git a/askbot/templatetags/extra_filters_jinja.py b/askbot/templatetags/extra_filters_jinja.py new file mode 100644 index 00000000..6f8c14af --- /dev/null +++ b/askbot/templatetags/extra_filters_jinja.py @@ -0,0 +1,214 @@ +import logging +from coffin import template as coffin_template +from django.core import exceptions as django_exceptions +from django.utils.translation import ugettext as _ +from django.contrib.humanize.templatetags import humanize +from django.template import defaultfilters +from askbot import exceptions as askbot_exceptions +from askbot import auth +from askbot import models +from askbot.deps.grapefruit import Color +from askbot.conf import settings as askbot_settings +from askbot.skins import utils as skin_utils +from askbot.utils import functions +from askbot.utils.slug import slugify + +register = coffin_template.Library() + +@register.filter +def collapse(input): + input = str(input) + return ' '.join(input.split()) + +@register.filter +def media(url): + """media filter - same as media tag, but + to be used as a filter in jinja templates + like so {{'/some/url.gif'|media}} + """ + if url: + return skin_utils.get_media_url(url) + else: + return '' + +diff_date = register.filter(functions.diff_date) + +setup_paginator = register.filter(functions.setup_paginator) + +slugify = register.filter(slugify) + +register.filter( + name = 'intcomma', + filter_func = humanize.intcomma, + jinja2_only = True + ) + +register.filter( + name = 'urlencode', + filter_func = defaultfilters.urlencode, + jinja2_only = True + ) + +register.filter( + name = 'default_if_none', + filter_func = defaultfilters.default_if_none, + jinja2_only = True + ) + +def make_template_filter_from_permission_assertion( + assertion_name = None, + filter_name = None, + allowed_exception = None + ): + """a decorator-like function that will create a True/False test from + permission assertion + """ + def filter_function(user, post): + + if askbot_settings.ALWAYS_SHOW_ALL_UI_FUNCTIONS: + return True + + if user.is_anonymous(): + return False + + assertion = getattr(user, assertion_name) + if allowed_exception: + try: + assertion(post) + return True + except allowed_exception: + return True + except django_exceptions.PermissionDenied: + return False + else: + try: + assertion(post) + return True + except django_exceptions.PermissionDenied: + return False + + register.filter(filter_name, filter_function) + return filter_function + + +@register.filter +def can_moderate_user(user, other_user): + if user.is_authenticated() and user.can_moderate_user(other_user): + return True + return False + +can_flag_offensive = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_flag_offensive', + filter_name = 'can_flag_offensive', + allowed_exception = askbot_exceptions.DuplicateCommand + ) + +can_post_comment = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_post_comment', + filter_name = 'can_post_comment' + ) + +can_close_question = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_close_question', + filter_name = 'can_close_question' + ) + +can_delete_comment = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_delete_comment', + filter_name = 'can_delete_comment' + ) + +#this works for questions, answers and comments +can_delete_post = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_delete_post', + filter_name = 'can_delete_post' + ) + +can_reopen_question = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_reopen_question', + filter_name = 'can_reopen_question' + ) + +can_edit_post = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_edit_post', + filter_name = 'can_edit_post' + ) + +can_retag_question = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_retag_question', + filter_name = 'can_retag_question' + ) + +can_accept_best_answer = make_template_filter_from_permission_assertion( + assertion_name = 'assert_can_accept_best_answer', + filter_name = 'can_accept_best_answer' + ) + +@register.filter +def can_see_offensive_flags(user, post): + """Determines if a User can view offensive flag counts. + there is no assertion like this User.assert_can... + so all of the code is here + + user can see flags on own posts + otherwise enough rep is required + or being a moderator or administrator + + suspended or blocked users cannot see flags + """ + if user.is_authenticated(): + if user == post.get_owner(): + return True + if user.reputation >= askbot_settings.MIN_REP_TO_VIEW_OFFENSIVE_FLAGS: + return True + elif user.is_administrator() or user.is_moderator(): + return True + else: + return False + else: + return False + +@register.filter +def can_view_user_edit(request_user, target_user): + return auth.can_view_user_edit(request_user, target_user) + +@register.filter +def can_view_user_votes(request_user, target_user): + return auth.can_view_user_votes(request_user, target_user) + +@register.filter +def can_view_user_preferences(request_user, target_user): + return auth.can_view_user_preferences(request_user, target_user) + +@register.filter +def is_user_self(request_user, target_user): + return auth.is_user_self(request_user, target_user) + +@register.filter +def cnprog_intword(number): + try: + if 1000 <= number < 10000: + string = str(number)[0:1] + return '<span class="thousand">%sk</span>' % string + else: + return number + except: + return number + +@register.filter +def humanize_counter(number): + if number == 0: + return _('no items in counter') + elif number >= 1000: + number = number/1000 + s = '%.1f' % number + if s.endswith('.0'): + return s[:-2] + 'k' + else: + return s + 'k' + else: + return str(number) + +@register.filter +def absolute_value(number): + return abs(number) diff --git a/askbot/templatetags/extra_tags.py b/askbot/templatetags/extra_tags.py index 685ff102..be7a2561 100644 --- a/askbot/templatetags/extra_tags.py +++ b/askbot/templatetags/extra_tags.py @@ -74,10 +74,55 @@ def tag_font_size(max_size, min_size, current_size): return MIN_FONTSIZE + round((MAX_FONTSIZE - MIN_FONTSIZE) * weight) -cnprog_paginator = register.inclusion_tag( - functions.setup_paginator - "paginator.html", - ): +#todo: this function may need to be removed to simplify the paginator functionality +LEADING_PAGE_RANGE_DISPLAYED = TRAILING_PAGE_RANGE_DISPLAYED = 5 +LEADING_PAGE_RANGE = TRAILING_PAGE_RANGE = 4 +NUM_PAGES_OUTSIDE_RANGE = 1 +ADJACENT_PAGES = 2 +@register.inclusion_tag("paginator.html") +def cnprog_paginator(context): + """ + custom paginator tag + Inspired from http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/ + """ + if (context["is_paginated"]): + " Initialize variables " + in_leading_range = in_trailing_range = False + pages_outside_leading_range = pages_outside_trailing_range = range(0) + + if (context["pages"] <= LEADING_PAGE_RANGE_DISPLAYED): + in_leading_range = in_trailing_range = True + page_numbers = [n for n in range(1, context["pages"] + 1) if n > 0 and n <= context["pages"]] + elif (context["page"] <= LEADING_PAGE_RANGE): + in_leading_range = True + page_numbers = [n for n in range(1, LEADING_PAGE_RANGE_DISPLAYED + 1) if n > 0 and n <= context["pages"]] + pages_outside_leading_range = [n + context["pages"] for n in range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)] + elif (context["page"] > context["pages"] - TRAILING_PAGE_RANGE): + in_trailing_range = True + page_numbers = [n for n in range(context["pages"] - TRAILING_PAGE_RANGE_DISPLAYED + 1, context["pages"] + 1) if n > 0 and n <= context["pages"]] + pages_outside_trailing_range = [n + 1 for n in range(0, NUM_PAGES_OUTSIDE_RANGE)] + else: + page_numbers = [n for n in range(context["page"] - ADJACENT_PAGES, context["page"] + ADJACENT_PAGES + 1) if n > 0 and n <= context["pages"]] + pages_outside_leading_range = [n + context["pages"] for n in range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)] + pages_outside_trailing_range = [n + 1 for n in range(0, NUM_PAGES_OUTSIDE_RANGE)] + + extend_url = context.get('extend_url', '') + return { + "base_url": context["base_url"], + "is_paginated": context["is_paginated"], + "previous": context["previous"], + "has_previous": context["has_previous"], + "next": context["next"], + "has_next": context["has_next"], + "page": context["page"], + "pages": context["pages"], + "page_numbers": page_numbers, + "in_leading_range" : in_leading_range, + "in_trailing_range" : in_trailing_range, + "pages_outside_leading_range": pages_outside_leading_range, + "pages_outside_trailing_range": pages_outside_trailing_range, + "extend_url" : extend_url + } @register.inclusion_tag("pagesize.html") def cnprog_pagesize(context): diff --git a/askbot/utils/slug.py b/askbot/utils/slug.py index d4f2a263..dbf794ce 100644 --- a/askbot/utils/slug.py +++ b/askbot/utils/slug.py @@ -7,14 +7,14 @@ slug will be simply equal to the input text """ from unidecode import unidecode from django.template import defaultfilters -from askbot.conf import settings as askbot_settings +from django.conf import settings def slugify(input_text, max_length=50): """custom slugify function that removes diacritic modifiers from the characters """ - if askbot_settings.USE_ASCII_ONLY_SLUGS == True: + if getattr(settings, 'ALLOW_UNICODE_SLUGS', False) == False: if input_text == '': return input_text slug = defaultfilters.slugify(unidecode(input_text)) diff --git a/askbot/views/readers.py b/askbot/views/readers.py index e7f573ad..3d95ca8d 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -343,8 +343,12 @@ def questions(request): #print simplejson.dumps(output) return HttpResponse(simplejson.dumps(output), mimetype='application/json') else: + before = datetime.datetime.now() template = ENV.get_template('questions.jinja.html') - return HttpResponse(template.render(template_context)) + response = HttpResponse(template.render(template_context)) + after = datetime.datetime.now() + print after - before + return response #after = datetime.datetime.now() #print 'time to render %s' % (after - before) |