summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-01-23 09:23:14 -0300
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-01-23 09:23:14 -0300
commit462f820fad82a35e90f24594aad9344a8b56b0c3 (patch)
treeae785968998b67342574d21dd21348dc0c45c02b
parent1b212583615595c4d33f35bd9514a0a895a7e673 (diff)
parent3c736256ce95720f778898588b881f83588716b0 (diff)
downloadaskbot-462f820fad82a35e90f24594aad9344a8b56b0c3.tar.gz
askbot-462f820fad82a35e90f24594aad9344a8b56b0c3.tar.bz2
askbot-462f820fad82a35e90f24594aad9344a8b56b0c3.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
Conflicts: askbot/feed.py
-rw-r--r--askbot/doc/source/changelog.rst1
-rw-r--r--askbot/feed.py6
-rw-r--r--askbot/skins/common/templates/question/answer_vote_buttons.html2
-rw-r--r--askbot/skins/default/templates/main_page/javascript.html9
-rw-r--r--askbot/skins/default/templates/question/answer_tab_bar.html2
-rw-r--r--askbot/skins/default/templates/question/javascript.html9
-rw-r--r--askbot/templatetags/extra_filters_jinja.py17
-rw-r--r--askbot/tests/page_load_tests.py9
-rw-r--r--askbot/urls.py2
-rw-r--r--setup.py2
10 files changed, 37 insertions, 22 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index b4f5ead7..d9c85e1b 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -7,6 +7,7 @@ Development version (not released yet)
* Made email recovery link work when askbot is deployed on subdirectory (Evgeny)
* Added tests for the CSRF_COOKIE_DOMAIN setting in the startup_procedures (Evgeny)
* Askbot now respects django's staticfiles app (Radim Řehůřek, Evgeny)
+* Fixed the url translation bug (Evgeny)
0.7.39 (Jan 11, 2012)
---------------------
diff --git a/askbot/feed.py b/askbot/feed.py
index 8c8e357e..776aad5e 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -60,13 +60,13 @@ class RssIndividualQuestionFeed(Feed):
then for each answer - the answer itself, then
answer comments
"""
-
chain_elements = list()
chain_elements.append([item,])
chain_elements.append(
Post.objects.get_comments().filter(parent=item)
)
- answers = Post.objects.get_answers().filter(question = item.id)
+
+ answers = Post.objects.get_answers().filter(thread = item.thread)
for answer in answers:
chain_elements.append([answer,])
chain_elements.append(
@@ -160,7 +160,7 @@ class RssLastestQuestionsFeed(Feed):
#if there are tags in GET, filter the
#questions additionally
for tag in tags:
- qs = qs.filter(tags__name = tag)
+ qs = qs.filter(thread__tags__name = tag)
return qs.order_by('-thread__last_activity_at')[:30]
diff --git a/askbot/skins/common/templates/question/answer_vote_buttons.html b/askbot/skins/common/templates/question/answer_vote_buttons.html
index 6f7e29b5..68bff3ed 100644
--- a/askbot/skins/common/templates/question/answer_vote_buttons.html
+++ b/askbot/skins/common/templates/question/answer_vote_buttons.html
@@ -10,6 +10,6 @@
title="{% trans %}mark this answer as correct (click again to undo){% endtrans %}"
{% else %}
alt="{% trans question_author=question.author.username %}{{question_author}} has selected this answer as correct{% endtrans %}"
- title="{% trans questsion_author=question.author.username%}{{question_author}} has selected this answer as correct{% endtrans %}"
+ title="{% trans question_author=question.author.username%}{{question_author}} has selected this answer as correct{% endtrans %}"
{% endif %}
/>
diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html
index bbe435d3..6a90c758 100644
--- a/askbot/skins/default/templates/main_page/javascript.html
+++ b/askbot/skins/default/templates/main_page/javascript.html
@@ -20,14 +20,7 @@
askbot['urls']['unmark_tag'] = '{% url unmark_tag %}';
askbot['urls']['set_tag_filter_strategy'] = '{% url "set_tag_filter_strategy" %}';
askbot['urls']['questions'] = '{% url "questions" %}';
- {% if settings.ASKBOT_TRANSLATE_URL %}
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/" }}';
- askbot['urls']['user_url_template'] = scriptUrl + '{% trans %}users/{% endtrans %}{{ "{{user_id}}" }}/{{ "{{slug}}" }}/';
- {% else %}
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/" }}';
- askbot['urls']['user_url_template'] = scriptUrl + '{% trans %}users/{% endtrans %}{{ "{{user_id}}" }}/{{ "{{slug}}" }}/';
- {% endif %}
- askbot['messages']['name_of_anonymous_user'] = '{{ name_of_anonymous_user }}';
+ askbot['urls']['question_url_template'] = scriptUrl + '{{'question/'|transurl}}{{ "{{QuestionID}}/" }}';
</script>
<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
{% if request.user.is_authenticated() %}
diff --git a/askbot/skins/default/templates/question/answer_tab_bar.html b/askbot/skins/default/templates/question/answer_tab_bar.html
index 94220089..0675a834 100644
--- a/askbot/skins/default/templates/question/answer_tab_bar.html
+++ b/askbot/skins/default/templates/question/answer_tab_bar.html
@@ -8,7 +8,7 @@
</h2>
<div class="tabsA">
<span class="label">
- Sort by »
+ {% trans %}Sort by »{% endtrans %}
</span>
<a id="oldest" href="{{ question.get_absolute_url() }}?sort=oldest#sort-top"
title="{% trans %}oldest answers will be shown first{% endtrans %}"
diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html
index 18d2dfa1..9c8e7fc6 100644
--- a/askbot/skins/default/templates/question/javascript.html
+++ b/askbot/skins/default/templates/question/javascript.html
@@ -11,13 +11,8 @@
askbot['urls']['editComment'] = '{% url edit_comment %}';
askbot['urls']['deleteComment'] = '{% url delete_comment %}';
askbot['urls']['getComment'] = '{% url get_comment %}';
- {%if settings.ASKBOT_TRANSLATE_URL %}
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #}
- askbot['urls']['vote_url_template'] = scriptUrl + '{% trans %}questions/{% endtrans %}{{ "{{QuestionID}}/" }}{% trans %}vote/{% endtrans %}';
- {%else%}
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #}
- askbot['urls']['vote_url_template'] = scriptUrl + '{% trans %}questions/{% endtrans %}{{ "{{QuestionID}}/" }}vote/';
- {%endif%}
+ askbot['urls']['question_url_template'] = scriptUrl + '{{ 'question/'|transurl }}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #}
+ askbot['urls']['vote_url_template'] = scriptUrl + '{{ 'questions/'|transurl }}{{ "{{QuestionID}}/" }}{{ 'vote/'|transurl }}';
askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}';
askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}';
askbot['urls']['upvote_comment'] = '{% url upvote_comment %}';
diff --git a/askbot/templatetags/extra_filters_jinja.py b/askbot/templatetags/extra_filters_jinja.py
index d98c4a4f..52180da5 100644
--- a/askbot/templatetags/extra_filters_jinja.py
+++ b/askbot/templatetags/extra_filters_jinja.py
@@ -1,6 +1,7 @@
import datetime
import re
import time
+import urllib
from coffin import template as coffin_template
from django.core import exceptions as django_exceptions
from django.utils.translation import ugettext as _
@@ -10,6 +11,7 @@ from django.core.urlresolvers import reverse, resolve
from django.http import Http404
from askbot import exceptions as askbot_exceptions
from askbot.conf import settings as askbot_settings
+from django.conf import settings as django_settings
from askbot.skins import utils as skin_utils
from askbot.utils import functions
from askbot.utils.slug import slugify
@@ -45,6 +47,21 @@ def clean_login_url(url):
return reverse('index')
@register.filter
+def transurl(url):
+ """translate url, when appropriate and percent-
+ escape it, that's important, othervise it won't match
+ the urlconf"""
+ try:
+ url.decode('ascii')
+ except UnicodeError:
+ raise ValueError(
+ u'string %s is not good for url - must be ascii' % url
+ )
+ if getattr(django_settings, 'ASKBOT_TRANSLATE_URL', False):
+ return urllib.quote(_(url).encode('utf-8'))
+ return url
+
+@register.filter
def country_display_name(country_code):
country_dict = dict(countries.COUNTRIES)
return country_dict[country_code]
diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py
index d5fabac8..16732e99 100644
--- a/askbot/tests/page_load_tests.py
+++ b/askbot/tests/page_load_tests.py
@@ -128,6 +128,15 @@ class PageLoadTestCase(AskbotTestCase):
status_code=status_code,
kwargs={'url':'rss'})
self.try_url(
+ 'feeds',
+ kwargs={'url':'rss'},
+ data={'tags':'one-tag'},
+ status_code=status_code)
+ #self.try_url(
+ # 'feeds',
+ # kwargs={'url':'question'},
+ # status_code=status_code)
+ self.try_url(
'about',
status_code=status_code,
template='static_page.html')
diff --git a/askbot/urls.py b/askbot/urls.py
index bcae5c85..3d17ed1b 100644
--- a/askbot/urls.py
+++ b/askbot/urls.py
@@ -14,7 +14,7 @@ from askbot.skins.utils import update_media_revision
admin.autodiscover()
update_media_revision()#needs to be run once, so put it here
-if hasattr(settings, "ASKBOT_TRANSLATE_URL") and settings.ASKBOT_TRANSLATE_URL:
+if getattr(settings, "ASKBOT_TRANSLATE_URL", False):
from django.utils.translation import ugettext as _
else:
_ = lambda s:s
diff --git a/setup.py b/setup.py
index 2227aba3..e148704b 100644
--- a/setup.py
+++ b/setup.py
@@ -123,7 +123,7 @@ print """**************************************************************
* *
* Thanks for installing Askbot. *
* *
-* To start deploying type: >askbot-setup *
+* To start deploying type: askbot-setup *
* Please take a look at the manual askbot/doc/INSTALL *
* And please do not hesitate to ask your questions at *
* at http://askbot.org *