summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2011-11-11 00:03:53 +0100
committerTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2011-11-11 00:03:53 +0100
commit069be3d7fb885df47503f274a2894a722deae03c (patch)
treea2772ad8c5dc6682fc4c53e59cf9e6ead8c60cde
parentbe2267211fcfdb28b769552050225bf60343bf65 (diff)
parent82e7b785a3ca9fb189dea94c18b408cd07106ee3 (diff)
downloadaskbot-069be3d7fb885df47503f274a2894a722deae03c.tar.gz
askbot-069be3d7fb885df47503f274a2894a722deae03c.tar.bz2
askbot-069be3d7fb885df47503f274a2894a722deae03c.zip
Merge remote-tracking branch 'origin/master' into wikipost
-rw-r--r--askbot/__init__.py2
-rw-r--r--askbot/setup_templates/settings.py4
-rw-r--r--askbot/setup_templates/settings.py.mustache8
-rw-r--r--askbot/skins/common/templates/question/answer_vote_buttons.html2
-rw-r--r--askbot/startup_procedures.py54
5 files changed, 54 insertions, 16 deletions
diff --git a/askbot/__init__.py b/askbot/__init__.py
index c69e532c..1c822e05 100644
--- a/askbot/__init__.py
+++ b/askbot/__init__.py
@@ -9,7 +9,7 @@ import smtplib
import sys
import logging
-VERSION = (0, 7, 27)
+VERSION = (0, 7, 29)
#necessary for interoperability of django and coffin
try:
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index ca6d2ebb..ed5c30da 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -209,11 +209,11 @@ ALLOW_UNICODE_SLUGS = False
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
#Celery Settings
-BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
+BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
CELERY_ALWAYS_EAGER = True
import djcelery
djcelery.setup_loader()
-CSRF_COOKIE_NAME = 'askbot_scrf'
+CSRF_COOKIE_NAME = 'askbot_csrf'
CSRF_COOKIE_DOMAIN = ''#enter domain name here - e.g. example.com
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
index ad954734..fa0b20d0 100644
--- a/askbot/setup_templates/settings.py.mustache
+++ b/askbot/setup_templates/settings.py.mustache
@@ -175,6 +175,7 @@ CACHE_BACKEND = 'locmem://'
#needed for django-keyedcache
CACHE_TIMEOUT = 6000
CACHE_PREFIX = 'askbot' #make this unique
+CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
#If you use memcache you may want to uncomment the following line to enable memcached based sessions
#SESSION_ENGINE = 'django.contrib.sessions.backends.cache_db'
@@ -207,11 +208,12 @@ ALLOW_UNICODE_SLUGS = False
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
#Celery Settings
-BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
+BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
CELERY_ALWAYS_EAGER = True
import djcelery
djcelery.setup_loader()
+DOMAIN_NAME = '{{domain_name}}'
-CSRF_COOKIE_NAME = '{{domain_name}}_scrf'
-CSRF_COOKIE_DOMAIN = '{{domain_name}}'#enter domain name here - e.g. example.com
+CSRF_COOKIE_NAME = '{{domain_name}}_csrf'
+CSRF_COOKIE_DOMAIN = DOMAIN_NAME
diff --git a/askbot/skins/common/templates/question/answer_vote_buttons.html b/askbot/skins/common/templates/question/answer_vote_buttons.html
index 3445b9b2..e3072ae4 100644
--- a/askbot/skins/common/templates/question/answer_vote_buttons.html
+++ b/askbot/skins/common/templates/question/answer_vote_buttons.html
@@ -3,7 +3,7 @@
visitor_vote = user_answer_votes[answer.id]
)
}}
-{% if request.user == question.author or request.user.is_authenticated() and (request.user.is_moderator() or request.user.is_superuser()) %}
+{% if request.user == question.author or request.user.is_authenticated() and (request.user.is_moderator() or request.user.is_administrator()) %}
<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
{% if answer.accepted %}
src="{{'/images/vote-accepted-on.png'|media}}"
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py
index 08b91e7a..bf988881 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -34,7 +34,7 @@ def format_as_text_tuple_entries(items):
#
# *validate emails in settings.py
def test_askbot_url():
- """Tests the ASKBOT_URL setting for the
+ """Tests the ASKBOT_URL setting for the
well-formedness and raises the ImproperlyConfigured
exception, if the setting is not good.
"""
@@ -91,8 +91,8 @@ def test_middleware():
if missing_middleware_set:
error_message = """\n\nPlease add the following middleware (listed after this message)
-to the MIDDLEWARE_CLASSES variable in your site settings.py file.
-The order the middleware records may be important, please take a look at the example in
+to the MIDDLEWARE_CLASSES variable in your site settings.py file.
+The order the middleware records may be important, please take a look at the example in
https://github.com/ASKBOT/askbot-devel/blob/master/askbot/setup_templates/settings.py:\n\n"""
middleware_text = format_as_text_tuple_entries(missing_middleware_set)
raise ImproperlyConfigured(PREAMBLE + error_message + middleware_text)
@@ -112,7 +112,7 @@ the list of MIDDLEWARE_CLASSES in your settings.py - these are not used any more
middleware_text = format_as_text_tuple_entries(remove_middleware_set)
raise ImproperlyConfigured(PREAMBLE + error_message + middleware_text)
-
+
def test_i18n():
"""askbot requires use of USE_I18N setting"""
@@ -124,7 +124,7 @@ def test_i18n():
)
def try_import(module_name, pypi_package_name):
- """tries importing a module and advises to install
+ """tries importing a module and advises to install
A corresponding Python package in the case import fails"""
try:
load_module(module_name)
@@ -173,22 +173,57 @@ def test_encoding():
)
def test_template_loader():
- """Sends a warning if you have an old style template
+ """Sends a warning if you have an old style template
loader that used to send a warning"""
old_template_loader = 'askbot.skins.loaders.load_template_source'
if old_template_loader in django_settings.TEMPLATE_LOADERS:
raise ImproperlyConfigured(PREAMBLE + \
"\nPlease change: \n"
- "'askbot.skins.loaders.load_template_source', to\n"
+ "'askbot.skins.loaders.load_template_source', to\n"
"'askbot.skins.loaders.filesystem_load_template_source',\n"
"in the TEMPLATE_LOADERS of your settings.py file"
)
def test_celery():
- """Tests celery settings"""
- if hasattr(django_settings, 'BROKER_BACKEND'):
+ """Tests celery settings
+ todo: we are testing two things here
+ that correct name is used for the setting
+ and that a valid value is chosen
+ """
+ broker_backend = getattr(django_settings, 'BROKER_BACKEND', None)
+ broker_transport = getattr(django_settings, 'BROKER_TRANSPORT', None)
+
+ if broker_backend is None:
+ if broker_transport is None:
+ raise ImproperlyConfigured(PREAMBLE + \
+ "\nPlease add\n"
+ 'BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"\n'
+ "or other valid value to your settings.py file"
+ )
+ else:
+ #todo: check that broker transport setting is valid
+ return
+
+ if broker_backend != broker_transport:
raise ImproperlyConfigured(PREAMBLE + \
"\nPlease rename setting BROKER_BACKEND to BROKER_TRANSPORT\n"
+ "in your settings.py file\n"
+ "If you have both in your settings.py - then\n"
+ "delete the BROKER_BACKEND setting and leave the BROKER_TRANSPORT"
+ )
+
+ if hasattr(django_settings, 'BROKER_BACKEND') and not hasattr(django_settings, 'BROKER_TRANSPORT'):
+ raise ImproperlyConfigured(PREAMBLE + \
+ "\nPlease rename setting BROKER_BACKEND to BROKER_TRANSPORT\n"
+ "in your settings.py file"
+ )
+
+def test_cache():
+ """Tests cache settings"""
+ if not hasattr(django_settings, 'CACHE_MIDDLEWARE_ANONYMOUS_ONLY'):
+ raise ImproperlyConfigured(PREAMBLE + \
+ "\nPlease set\n"
+ "CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True\n"
"in your settings.py file"
)
@@ -206,6 +241,7 @@ def run_startup_tests():
test_postgres()
test_middleware()
test_celery()
+ test_cache()
@transaction.commit_manually
def run():