summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-09-04 13:49:53 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-09-04 13:49:53 -0600
commit566a919d78825f6adaf4419feedfcdb899890d33 (patch)
treeb069695c5479941bf9fc64feae7c34b38000a75d
parent8040bc68785c349518de251ab7313404b95e03c2 (diff)
parent81050cd0e701772a47b224579fbd4f49b59af9a7 (diff)
downloadaskbot-566a919d78825f6adaf4419feedfcdb899890d33.tar.gz
askbot-566a919d78825f6adaf4419feedfcdb899890d33.tar.bz2
askbot-566a919d78825f6adaf4419feedfcdb899890d33.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r--askbot/__init__.py6
-rw-r--r--askbot/db0
-rw-r--r--askbot/deps/django_authopenid/views.py2
-rw-r--r--askbot/doc/source/changelog.rst1
-rw-r--r--askbot/doc/source/optional-modules.rst5
-rw-r--r--askbot/management/commands/clean_session.py52
-rw-r--r--askbot/migrations/0001_initial.py10
-rw-r--r--askbot/setup_templates/settings.py1
-rw-r--r--askbot/setup_templates/settings.py.mustache1
-rw-r--r--askbot/setup_templates/tinymce_sample_config.py26
-rw-r--r--askbot/skins/common/media/js/wmd/wmd.js5
-rw-r--r--askbot/skins/default/templates/meta/bottom_scripts.html6
-rw-r--r--askbot/skins/default/templates/meta/html_head_stylesheets.html3
-rw-r--r--askbot/skins/default/templates/question/new_answer_form.html1
-rw-r--r--askbot/skins/default/templates/widgets/ask_form.html1
-rw-r--r--askbot/skins/default/templates/widgets/user_navigation.html2
-rw-r--r--askbot/startup_procedures.py19
-rw-r--r--askbot/tests/utils_tests.py17
-rw-r--r--askbot/utils/forms.py5
-rw-r--r--askbot_requirements.txt1
20 files changed, 124 insertions, 40 deletions
diff --git a/askbot/__init__.py b/askbot/__init__.py
index 8e4f20ab..51b7c24f 100644
--- a/askbot/__init__.py
+++ b/askbot/__init__.py
@@ -5,6 +5,7 @@ Functions in the askbot module perform various
basic actions on behalf of the forum application
"""
import os
+import platform
VERSION = (0, 7, 43)
@@ -30,10 +31,13 @@ REQUIREMENTS = {
'recaptcha_works': 'django-recaptcha-works',
'openid': 'python-openid',
'pystache': 'pystache==0.3.1',
- 'lamson': 'Lamson',
'pytz': 'pytz',
+ 'longerusername': 'longerusername',
}
+if platform.system() != 'Windows':
+ REQUIREMENTS['lamson'] = 'Lamson'
+
#necessary for interoperability of django and coffin
try:
from askbot import patches
diff --git a/askbot/db b/askbot/db
deleted file mode 100644
index e69de29b..00000000
--- a/askbot/db
+++ /dev/null
diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py
index cace9968..4feae3fa 100644
--- a/askbot/deps/django_authopenid/views.py
+++ b/askbot/deps/django_authopenid/views.py
@@ -1072,7 +1072,7 @@ def signup_with_password(request):
#todo: here we have duplication of get_password_login_provider...
form = RegisterForm(
initial={
- 'next':next,
+ 'next': get_next_url(request),
'login_provider': provider_name
}
)
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index d88cd734..9d28dd5f 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -3,6 +3,7 @@ Changes in Askbot
Development version
-------------------
+* Allow user names longer than 30 characters (Evgeny)
* Option to disable feedback form for the anonymos users (Evgeny)
* Optional restriction to have confirmed email address to join forum (Evgeny)
* Optional list of allowed email addresses and email domain name for the new users (Evgeny)
diff --git a/askbot/doc/source/optional-modules.rst b/askbot/doc/source/optional-modules.rst
index 25bb5cc8..3dc2b5ae 100644
--- a/askbot/doc/source/optional-modules.rst
+++ b/askbot/doc/source/optional-modules.rst
@@ -216,6 +216,11 @@ Askbot supports posting replies by email. For this feature to work ``Lamson`` a
pip install django-lamson
+.. note::
+ On Windows installation of the Lamson module may require
+ additional work. Askbot does not support this feature
+ on Windows automatically.
+
The lamson daemon needs a folder to store it's mail queue files and a folder to store log files, create the folders folder named ``run`` and ``logs`` within your project folder by executing the following commands:
mkdir run
diff --git a/askbot/management/commands/clean_session.py b/askbot/management/commands/clean_session.py
index 6ba9352c..2e663b22 100644
--- a/askbot/management/commands/clean_session.py
+++ b/askbot/management/commands/clean_session.py
@@ -1,13 +1,18 @@
+"""deletes expired sessions from the session database table
+works only when sessions are stored in the database
+"""
from django.core.management.base import NoArgsCommand
from django.contrib.sessions.models import Session
from django.db import transaction
from optparse import make_option
-from askbot.utils.console import print_progress
+from askbot.utils.console import ProgressBar
from datetime import datetime
-DELETE_LIMIT = 1000
+ITEMS_PER_TRANSACTION = 1000
class Command(NoArgsCommand):
+ """Django management command class"""
+
option_list = NoArgsCommand.option_list + (
make_option('--quiet',
action='store_true',
@@ -19,32 +24,23 @@ class Command(NoArgsCommand):
@transaction.commit_manually
def handle_noargs(self, **options):
- '''deletes old sessions'''
+ """deletes old sessions"""
quiet = options.get('quiet', False)
- expired_session_count = Session.objects.filter(expire_date__lt=datetime.now()).count()
- expired_session_list= Session.objects.filter(expire_date__lt=datetime.now()).values_list('session_key', flat=True)
- transaction.commit()
-
- if not quiet:
- print "There are %d expired sessions" % expired_session_count
- range_limit = len(expired_session_list) - 1
- higher_limit = lower_limit = 0
+ expired_sessions = Session.objects.filter(
+ expire_date__lt=datetime.now()
+ )
+ count = expired_sessions.count()
+ expired_sessions = expired_sessions.iterator()
+ if quiet is False:
+ message = 'There are %d expired sessions' % count
+ expired_sessions = ProgressBar(expired_sessions, count, message)
+
+ deleted_count = 0
+ for session in expired_sessions:
+ session.delete()
+ deleted_count += 1
+ if deleted_count % ITEMS_PER_TRANSACTION == 0:
+ transaction.commit()
- for i in range(DELETE_LIMIT, range_limit, DELETE_LIMIT):
- lower_limit = i
- higher_limit = lower_limit + DELETE_LIMIT
- sublist = expired_session_list[lower_limit:higher_limit]
- Session.objects.filter(session_key__in = sublist).delete()
- transaction.commit()
- if not quiet:
- print_progress(higher_limit-1, expired_session_count)
-
- if higher_limit < expired_session_list:
- sublist = expired_session_list[higher_limit:expired_session_count]
- Session.objects.filter(session_key__in = sublist).delete()
- print_progress(expired_session_count, expired_session_count)
- transaction.commit()
-
- if not quiet:
- print "sessions cleared"
+ transaction.commit()
diff --git a/askbot/migrations/0001_initial.py b/askbot/migrations/0001_initial.py
index 97febea3..ec119f92 100644
--- a/askbot/migrations/0001_initial.py
+++ b/askbot/migrations/0001_initial.py
@@ -26,17 +26,17 @@ class Migration(SchemaMigration):
def forwards(self, orm):
#1) patch the existing auth_user table
- safe_add_column('auth_user', 'website', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True), keep_default = False)
- safe_add_column('auth_user', 'about', self.gf('django.db.models.fields.TextField')(blank=True), keep_default = False)
+ safe_add_column('auth_user', 'website', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True, null=True), keep_default = False)
+ safe_add_column('auth_user', 'about', self.gf('django.db.models.fields.TextField')(blank=True, null=True), keep_default = False)
safe_add_column('auth_user', 'hide_ignored_questions', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default = False)
safe_add_column('auth_user', 'gold', self.gf('django.db.models.fields.SmallIntegerField')(default=0), keep_default = False)
safe_add_column('auth_user', 'email_isvalid', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default = False)
- safe_add_column('auth_user', 'real_name', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True), keep_default = False)
- safe_add_column('auth_user', 'location', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True), keep_default = False)
+ safe_add_column('auth_user', 'real_name', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True, null=True), keep_default = False)
+ safe_add_column('auth_user', 'location', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True, null=True), keep_default = False)
safe_add_column('auth_user', 'email_key', self.gf('django.db.models.fields.CharField')(max_length=32, null=True), keep_default = False)
safe_add_column('auth_user', 'date_of_birth', self.gf('django.db.models.fields.DateField')(null=True, blank=True), keep_default = False)
safe_add_column('auth_user', 'reputation', self.gf('django.db.models.fields.PositiveIntegerField')(default=1), keep_default = False)
- safe_add_column('auth_user', 'gravatar', self.gf('django.db.models.fields.CharField')(max_length=32), keep_default = False)
+ safe_add_column('auth_user', 'gravatar', self.gf('django.db.models.fields.CharField')(max_length=32, null=True), keep_default = False)
safe_add_column('auth_user', 'bronze', self.gf('django.db.models.fields.SmallIntegerField')(default=0), keep_default = False)
safe_add_column('auth_user', 'tag_filter_setting', self.gf('django.db.models.fields.CharField')(default='ignored', max_length=16), keep_default = False)
safe_add_column('auth_user', 'last_seen', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default = False)
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index 632c4e70..3b1f6bf5 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -150,6 +150,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
INSTALLED_APPS = (
+ 'longerusername',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
index 18ac214d..69b030ed 100644
--- a/askbot/setup_templates/settings.py.mustache
+++ b/askbot/setup_templates/settings.py.mustache
@@ -149,6 +149,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
INSTALLED_APPS = (
+ 'longerusername',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
diff --git a/askbot/setup_templates/tinymce_sample_config.py b/askbot/setup_templates/tinymce_sample_config.py
new file mode 100644
index 00000000..c75170b0
--- /dev/null
+++ b/askbot/setup_templates/tinymce_sample_config.py
@@ -0,0 +1,26 @@
+TINYMCE_COMPRESSOR = True
+TINYMCE_SPELLCHECKER = False
+TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'common/media/js/tinymce/')
+TINYMCE_URL = STATIC_URL + 'common/media/js/tinymce/'
+TINYMCE_DEFAULT_CONFIG = {
+ 'plugins': 'askbot_imageuploader,askbot_attachment',
+ 'theme': 'advanced',
+ 'content_css': STATIC_URL + 'default/media/style/tinymce/content.css',
+ 'force_br_newlines': True,
+ 'force_p_newlines': False,
+ 'forced_root_block': '',
+ 'mode' : 'textareas',
+ 'oninit': "function(){ tinyMCE.activeEditor.setContent(askbot['data']['editorContent'] || ''); }",
+ 'plugins': 'askbot_imageuploader,askbot_attachment',
+ 'theme_advanced_toolbar_location' : 'top',
+ 'theme_advanced_toolbar_align': 'left',
+ 'theme_advanced_buttons1': 'bold,italic,underline,|,bullist,numlist,|,undo,redo,|,link,unlink,askbot_imageuploader,askbot_attachment',
+ 'theme_advanced_buttons2': '',
+ 'theme_advanced_buttons3' : '',
+ 'theme_advanced_path': False,
+ 'theme_advanced_resizing': True,
+ 'theme_advanced_resize_horizontal': False,
+ 'theme_advanced_statusbar_location': 'bottom',
+ 'width': '723',
+ 'height': '250'
+}
diff --git a/askbot/skins/common/media/js/wmd/wmd.js b/askbot/skins/common/media/js/wmd/wmd.js
index 98af264f..c30fe11d 100644
--- a/askbot/skins/common/media/js/wmd/wmd.js
+++ b/askbot/skins/common/media/js/wmd/wmd.js
@@ -21,6 +21,7 @@ Attacklab.wmdBase = function(){
// Used to work around some browser bugs where we can't use feature testing.
+ global.isChrome = /chrome/.test(nav.userAgent.toLowerCase());
global.isIE = /msie/.test(nav.userAgent.toLowerCase());
global.isIE_5or6 = /msie 6/.test(nav.userAgent.toLowerCase()) || /msie 5/.test(nav.userAgent.toLowerCase());
global.isIE_7plus = global.isIE && !global.isIE_5or6;
@@ -1598,6 +1599,10 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
var regexText;
var replacementText;
+
+ if (global.isChrome) {//Chrome bug workaround
+ 'X'.match(/()./);
+ }
this.selection = this.selection.replace(/(^\n*)/, "");
this.startTag = this.startTag + re.$1;
diff --git a/askbot/skins/default/templates/meta/bottom_scripts.html b/askbot/skins/default/templates/meta/bottom_scripts.html
index 6c132203..1bcdca1f 100644
--- a/askbot/skins/default/templates/meta/bottom_scripts.html
+++ b/askbot/skins/default/templates/meta/bottom_scripts.html
@@ -6,6 +6,12 @@
<noscript class="noscript">
{% trans app_name = settings.APP_SHORT_NAME %}Please note: {{app_name}} requires javascript to work properly, please enable javascript in your browser, <a href="{{noscript_url}}">here is how</a>{% endtrans %}
</noscript>
+ <script type="text/javascript">
+ //IE fix to hide the red margin
+ var noscript = document.getElementsByTagName('noscript')[0];
+ noscript.style.padding = '0px';
+ noscript.style.backgroundColor = 'transparent';
+ </script>
</div>
<script type="text/javascript">
var i18nLang = '{{settings.LANGUAGE_CODE}}';
diff --git a/askbot/skins/default/templates/meta/html_head_stylesheets.html b/askbot/skins/default/templates/meta/html_head_stylesheets.html
index 8977f152..a9e4a644 100644
--- a/askbot/skins/default/templates/meta/html_head_stylesheets.html
+++ b/askbot/skins/default/templates/meta/html_head_stylesheets.html
@@ -8,7 +8,8 @@
{% if settings.USE_LOCAL_FONTS %}
{% include "meta/fonts.html" %}
{% else %}
- <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:400,700&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&amp;subset=latin-ext' rel='stylesheet' type='text/css'>
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&amp;subset=cyrillic-ext' rel='stylesheet' type='text/css'>
{% endif %}
{{ skin.get_extra_css_link() }}
{% if settings.USE_CUSTOM_CSS %}
diff --git a/askbot/skins/default/templates/question/new_answer_form.html b/askbot/skins/default/templates/question/new_answer_form.html
index 9868d3ba..b5def81b 100644
--- a/askbot/skins/default/templates/question/new_answer_form.html
+++ b/askbot/skins/default/templates/question/new_answer_form.html
@@ -1,6 +1,5 @@
<form
id="fmanswer"
- {% if user == question.author %}style="display:none"{% endif %}
action="{% url answer question.id %}"
method="post"
>{% csrf_token %}
diff --git a/askbot/skins/default/templates/widgets/ask_form.html b/askbot/skins/default/templates/widgets/ask_form.html
index 2ece84d5..77a92544 100644
--- a/askbot/skins/default/templates/widgets/ask_form.html
+++ b/askbot/skins/default/templates/widgets/ask_form.html
@@ -3,7 +3,6 @@
<div class="form-item">
<div id="askFormBar">
{% if not request.user.is_authenticated() %}
- <p>{% trans %}login to post question info{% endtrans %}</p>
<p>{% trans %}<span class=\"strong big\">You are welcome to start submitting your question anonymously</span>. When you submit the post, you will be redirected to the login/signup page. Your question will be saved in the current session and will be published after you log in. Login/signup process is very simple. Login takes about 30 seconds, initial signup takes a minute or less.{% endtrans %}</p>
{% else %}
{% if settings.EMAIL_VALIDATION %}
diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html
index 717cd7ee..227053b0 100644
--- a/askbot/skins/default/templates/widgets/user_navigation.html
+++ b/askbot/skins/default/templates/widgets/user_navigation.html
@@ -17,7 +17,7 @@
<a href="{{ settings.LOGOUT_URL }}?next={{ settings.LOGOUT_REDIRECT_URL }}">{% trans %}sign out{% endtrans %}</a>
{% endif %}
{% elif settings.USE_ASKBOT_LOGIN_SYSTEM %}
- <a href="{{ settings.LOGIN_URL }}?next={{request.path|clean_login_url}}">{% trans %}Hi, there! Please sign in{% endtrans %}</a>
+ <a href="{{ settings.LOGIN_URL }}?next={{request.path|clean_login_url}}">{% trans %}Hi there! Please sign in{% endtrans %}</a>
{% endif %}
{% if request.user.is_authenticated() and request.user.is_administrator() %}
<a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a>
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py
index 0fec6d5f..4b4575cf 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -512,6 +512,24 @@ def test_custom_user_profile_tab():
footer = 'Please carefully read about adding a custom user profile tab.'
print_errors(errors, header = header, footer = footer)
+def test_longerusername():
+ """tests proper installation of the "longerusername" app
+ """
+ errors = list()
+ if 'longerusername' not in django_settings.INSTALLED_APPS:
+ errors.append(
+ "add 'longerusername', as the first item in the INSTALLED_APPS"
+ )
+ else:
+ index = django_settings.INSTALLED_APPS.index('longerusername')
+ if index != 0:
+ message = "move 'longerusername', to the beginning of INSTALLED_APPS"
+ raise AskbotConfigError(message)
+
+ if errors:
+ errors.append('run "python manage.py migrate longerusername"')
+ print_errors(errors)
+
def run_startup_tests():
"""function that runs
all startup tests, mainly checking settings config so far
@@ -527,6 +545,7 @@ def run_startup_tests():
test_celery()
#test_csrf_cookie_domain()
test_staticfiles()
+ test_longerusername()
test_avatar()
settings_tester = SettingsTester({
'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': {
diff --git a/askbot/tests/utils_tests.py b/askbot/tests/utils_tests.py
new file mode 100644
index 00000000..7f252b69
--- /dev/null
+++ b/askbot/tests/utils_tests.py
@@ -0,0 +1,17 @@
+from django.test import TestCase
+from askbot.utils.url_utils import urls_equal
+
+class UrlUtilsTests(TestCase):
+
+ def tests_urls_equal(self):
+ e = urls_equal
+ self.assertTrue(e('', ''))
+ self.assertTrue(e('', '/', True))
+ self.assertTrue(e('http://cnn.com', 'http://cnn.com/', True))
+
+ self.assertFalse(e('https://cnn.com', 'http://cnn.com'))
+ self.assertFalse(e('http://cnn.com:80', 'http://cnn.com:8000'))
+
+ self.assertTrue(e('http://cnn.com/path', 'http://cnn.com/path/', True))
+ self.assertFalse(e('http://cnn.com/path', 'http://cnn.com/path/'))
+
diff --git a/askbot/utils/forms.py b/askbot/utils/forms.py
index 319e9b9d..4375ca17 100644
--- a/askbot/utils/forms.py
+++ b/askbot/utils/forms.py
@@ -9,6 +9,7 @@ from askbot.conf import settings as askbot_settings
from askbot.utils.slug import slugify
from askbot.utils.functions import split_list
from askbot import const
+from longerusername import MAX_USERNAME_LENGTH
import logging
import urllib
@@ -78,7 +79,9 @@ class UserNameField(StrippedNonEmptyCharField):
if 'error_messages' in kw:
error_messages.update(kw['error_messages'])
del kw['error_messages']
- super(UserNameField,self).__init__(max_length=30,
+
+ max_length = MAX_USERNAME_LENGTH
+ super(UserNameField,self).__init__(max_length=max_length,
widget=forms.TextInput(attrs=login_form_widget_attrs),
label=label,
error_messages=error_messages,
diff --git a/askbot_requirements.txt b/askbot_requirements.txt
index 7b619c36..885a21e3 100644
--- a/askbot_requirements.txt
+++ b/askbot_requirements.txt
@@ -19,3 +19,4 @@ django-recaptcha-works
python-openid
pystache==0.3.1
pytz
+longerusername