summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2012-01-22 20:15:57 +0100
committerTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2012-01-22 20:15:57 +0100
commit6145566d88d7e270ea6270d5ab2a21a194bb5a59 (patch)
tree44a596b193cc042b3af69b9d836a1c6e660fe139
parentec95dff2c17de24448f4eb29fbc6907991fbc800 (diff)
parent3c736256ce95720f778898588b881f83588716b0 (diff)
downloadaskbot-6145566d88d7e270ea6270d5ab2a21a194bb5a59.tar.gz
askbot-6145566d88d7e270ea6270d5ab2a21a194bb5a59.tar.bz2
askbot-6145566d88d7e270ea6270d5ab2a21a194bb5a59.zip
Merge branch 'master' into wikipost
-rw-r--r--askbot/doc/source/changelog.rst2
-rw-r--r--askbot/doc/source/contributors.rst2
-rw-r--r--askbot/doc/source/create-database.rst6
-rw-r--r--askbot/feed.py5
-rw-r--r--askbot/models/__init__.py2
-rw-r--r--askbot/models/question.py1
-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/startup_procedures.py2
-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
15 files changed, 44 insertions, 28 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index b4b810d6..d9c85e1b 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -3,9 +3,11 @@ Changes in Askbot
Development version (not released yet)
--------------------------------------
+* New data models!!! (`Tomasz Zieliński <http://pyconsultant.eu>`_)
* 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/doc/source/contributors.rst b/askbot/doc/source/contributors.rst
index 30e31175..a0b91518 100644
--- a/askbot/doc/source/contributors.rst
+++ b/askbot/doc/source/contributors.rst
@@ -11,6 +11,7 @@ Programming and documentation
* Mike Chen & Sailing Cai - original authors of CNPROG forum
* Evgeny Fadeev - founder of askbot
* `Adolfo Fitoria <http://fitoria.net>`_
+* `Tomasz Zielinski <http://pyconsultant.eu/>`_
* `Sayan Chowdhury <http://fosswithme.wordpress.com>`_
* Andy Knotts
* Benoit Lavine (with Windriver Software, Inc.)
@@ -27,7 +28,6 @@ Programming and documentation
* `Arun SAG <http://zer0c00l.in/>`_
* `Rag Sagar <https://github.com/ragsagar>`_
* `Alex Robbins <https://github.com/alexrobbins>`_
-* `Tomasz Zielinski <http://pyconsultant.eu/>`_
* `Tomasz Szynalski <http://antimoon.com>`_
* `Raghu Udiyar <http://raags.tumblr.com/>`_
* `Alexander Werner <https://twitter.com/#!/bundeswerner>`_
diff --git a/askbot/doc/source/create-database.rst b/askbot/doc/source/create-database.rst
index 52383f9e..55d5cd1c 100644
--- a/askbot/doc/source/create-database.rst
+++ b/askbot/doc/source/create-database.rst
@@ -4,11 +4,11 @@
Create database for Askbot
==========================
-Askbot has been successfully tested with `MySQL` and `PostgresQL` databases.
+Askbot has been successfully tested with `MySQL` and `PostgreSQL` databases.
-PostgresQL
+PostgreSQL
----------
-PostgresQL is the preferred database for Askbot - because it offers great
+PostgreSQL is the preferred database for Askbot - because it offers great
full text search functionality and supports transactions at the same time.
To use postgresql - install it (please see documentation elsewhere).
diff --git a/askbot/feed.py b/askbot/feed.py
index 6efeac69..c1933afe 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -51,14 +51,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(
@@ -144,7 +143,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/models/__init__.py b/askbot/models/__init__.py
index e7feecce..d98d4246 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2458,7 +2458,7 @@ def record_user_visit(user, timestamp, **kwargs):
when user visits any pages, we update the last_seen and
consecutive_days_visit_count
"""
- prev_last_seen = user.last_seen
+ prev_last_seen = user.last_seen or datetime.datetime.now()
user.last_seen = timestamp
if (user.last_seen - prev_last_seen).days == 1:
user.consecutive_days_visit_count += 1
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 60e80ba4..a112830d 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -15,6 +15,7 @@ from askbot.models.post import Post, PostRevision
from askbot.models import signals
from askbot import const
from askbot.utils.lists import LazyList
+from askbot.utils import mysql
class ThreadManager(models.Manager):
def get_tag_summary_from_threads(self, threads):
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/startup_procedures.py b/askbot/startup_procedures.py
index d50873d9..4c76be2c 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -467,7 +467,7 @@ def run_startup_tests():
#test_postgres()
test_middleware()
test_celery()
- test_csrf_cookie_domain()
+ #test_csrf_cookie_domain()
test_staticfiles()
settings_tester = SettingsTester({
'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': {
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 ace41e8b..1a56f951 100644
--- a/askbot/tests/page_load_tests.py
+++ b/askbot/tests/page_load_tests.py
@@ -148,6 +148,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 *