From 42e5c889ec4e91b2e71d315d33f8015ac9aafeb2 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Thu, 20 Oct 2011 14:38:48 -0300 Subject: added DOMAIN_NAME to settings --- askbot/setup_templates/settings.py.mustache | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index ad954734..18f9ac94 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -212,6 +212,7 @@ 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 -- cgit v1.2.3-1-g7c22 From 1aa50bbe284c2fbc092636f6d114e1a76760f01e Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 21 Oct 2011 10:13:14 -0300 Subject: changed celery broker setting name --- askbot/setup_templates/settings.py | 4 ++-- askbot/setup_templates/settings.py.mustache | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 83fe9997..dcdcb8a4 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -208,11 +208,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 18f9ac94..82d42377 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -207,7 +207,7 @@ 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 -- cgit v1.2.3-1-g7c22 From 7c0533bae490449ad9180ed00e3ceb876a2fbda9 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Wed, 9 Nov 2011 17:03:14 -0300 Subject: fixed celery startup_procedure test --- askbot/startup_procedures.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 08b91e7a..5a7b6799 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,25 +173,35 @@ 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'): + broker_backend = getattr(django_settings, 'BROKER_BACKEND', None) + broker_transport = getattr(django_settings, 'BROKER_TRANSPORT', None) + + if broker_backend != broker_transport: + raise ImproperlyConfigured(PREAMBLE + \ + "\nPlese check that BROKER_BACKEND and BROKER_TRANSPORT have \n" + "then same value in your settings.py file" + ) + + 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 run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far -- cgit v1.2.3-1-g7c22 From e9541d7227cb04edf4471ff70bb51b93f817ff48 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 9 Nov 2011 17:33:40 -0300 Subject: added CACHE_MIDDLEWARE_ANONYMOUS_ONLY setting and test, renamed BROKER_BACKEND setting and fixed a bug in the answer vote button template --- askbot/__init__.py | 2 +- askbot/setup_templates/settings.py | 2 +- askbot/setup_templates/settings.py.mustache | 3 ++- .../skins/common/templates/question/answer_vote_buttons.html | 2 +- askbot/startup_procedures.py | 10 ++++++++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index c69e532c..11954dda 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, 28) #necessary for interoperability of django and coffin try: diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index ca6d2ebb..52a047c5 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -209,7 +209,7 @@ 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 diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index ad954734..f712a5cb 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,7 +208,7 @@ 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 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()) %} Date: Wed, 9 Nov 2011 18:21:08 -0300 Subject: modified the startup_procedures message --- askbot/startup_procedures.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 3d6c4165..c07f4cfb 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -191,8 +191,10 @@ def test_celery(): if broker_backend != broker_transport: raise ImproperlyConfigured(PREAMBLE + \ - "\nPlese check that BROKER_BACKEND and BROKER_TRANSPORT have \n" - "then same value in your settings.py file" + "\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'): -- cgit v1.2.3-1-g7c22 From 82e7b785a3ca9fb189dea94c18b408cd07106ee3 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 9 Nov 2011 18:30:31 -0300 Subject: one more fix to the startup procedure for celery and incremented revision again --- askbot/__init__.py | 2 +- askbot/startup_procedures.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index 11954dda..1c822e05 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -9,7 +9,7 @@ import smtplib import sys import logging -VERSION = (0, 7, 28) +VERSION = (0, 7, 29) #necessary for interoperability of django and coffin try: diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index c07f4cfb..bf988881 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -185,10 +185,25 @@ def test_template_loader(): ) def test_celery(): - """Tests celery settings""" + """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" -- cgit v1.2.3-1-g7c22