summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore1
-rw-r--r--askbot/conf/skin_general_settings.py38
-rw-r--r--askbot/cron/askbot_cron_job2
-rw-r--r--askbot/feed.py59
-rw-r--r--askbot/middleware/locale.py26
-rw-r--r--askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py14
-rw-r--r--askbot/setup_templates/settings.py1
-rw-r--r--askbot/setup_templates/settings.py.mustache1
-rw-r--r--askbot/skins/default/media/style/lib_style.css22
-rw-r--r--askbot/skins/default/media/style/lib_style.less37
-rw-r--r--askbot/skins/default/media/style/style.less150
-rw-r--r--askbot/skins/default/templates/main_page/tab_bar.html4
-rw-r--r--askbot/skins/default/templates/question/question_card.html2
-rw-r--r--askbot/skins/utils.py36
-rw-r--r--askbot/startup_procedures.py19
15 files changed, 261 insertions, 151 deletions
diff --git a/.gitignore b/.gitignore
index 07a3f84f..08e42e57 100755
--- a/.gitignore
+++ b/.gitignore
@@ -47,3 +47,4 @@ run
recaptcha
/.ve
/db.sq3
+*.DS_Store
diff --git a/askbot/conf/skin_general_settings.py b/askbot/conf/skin_general_settings.py
index ccecdaba..6abee90a 100644
--- a/askbot/conf/skin_general_settings.py
+++ b/askbot/conf/skin_general_settings.py
@@ -30,6 +30,40 @@ settings.register(
)
)
+LANGUAGE_CHOICES = (
+ ('en', _("English")),
+ ('es', _("Spanish")),
+ ('ca', _("Catalan")),
+ ('de', _("German")),
+ ('el', _("Greek")),
+ ('fi', _("Finnish")),
+ ('fr', _("French")),
+ ('hi', _("Hindi")),
+ ('hu', _("Hungarian")),
+ ('it', _("Italian")),
+ ('ja', _("Japanese")),
+ ('ko', _("Korean")),
+ ('pt', _("Portuguese")),
+ ('pt_BR', _("Brazilian Portuguese")),
+ ('ro', _("Romanian")),
+ ('ru', _("Russian")),
+ ('sr', _("Serbian")),
+ ('tr', _("Turkish")),
+ ('vi', _("Vietnamese")),
+ ('zh_CN', _("Chinese")),
+ ('zh_TW', _("Chinese (Taiwan)")),
+ )
+
+settings.register(
+ values.StringValue(
+ GENERAL_SKIN_SETTINGS,
+ 'ASKBOT_LANGUAGE',
+ default = 'en',
+ choices = LANGUAGE_CHOICES,
+ description = _('Select Language'),
+ )
+)
+
settings.register(
values.BooleanValue(
GENERAL_SKIN_SETTINGS,
@@ -198,7 +232,7 @@ settings.register(
description = _('Apply custom style sheet (CSS)'),
help_text = _(
'Check if you want to change appearance '
- 'of your form by adding custom style sheet rules '
+ 'of your form by adding custom style sheet rules '
'(please see the next item)'
),
default = False
@@ -214,7 +248,7 @@ settings.register(
'<strong>To use this function</strong>, check '
'"Apply custom style sheet" option above. '
'The CSS rules added in this window will be applied '
- 'after the default style sheet rules. '
+ 'after the default style sheet rules. '
'The custom style sheet will be served dynamically at '
'url "&lt;forum url&gt;/custom.css", where '
'the "&lt;forum url&gt; part depends (default is '
diff --git a/askbot/cron/askbot_cron_job b/askbot/cron/askbot_cron_job
index 38bf0337..2886808b 100644
--- a/askbot/cron/askbot_cron_job
+++ b/askbot/cron/askbot_cron_job
@@ -9,7 +9,7 @@ PROJECT_PARENT_DIR=/path/to/dir_containing_askbot_site
PROJECT_DIR_NAME=askbot_site
export PYTHONPATH=$PROJECT_PARENT_DIR:$PYTHONPATH
-PROJECT_ROOT=$PYTHONPATH/$PROJECT_NAME
+PROJECT_ROOT=$PROJECT_PARENT_DIR/$PROJECT_DIR_NAME
#these are actual commands that are to be run
python $PROJECT_ROOT/manage.py send_email_alerts
diff --git a/askbot/feed.py b/askbot/feed.py
index c1933afe..776aad5e 100644
--- a/askbot/feed.py
+++ b/askbot/feed.py
@@ -25,20 +25,29 @@ from askbot.conf import settings as askbot_settings
class RssIndividualQuestionFeed(Feed):
"""rss feed class for particular questions
"""
- title = askbot_settings.APP_TITLE + _(' - ')+ _('Individual question feed')
- link = askbot_settings.APP_URL
- description = askbot_settings.APP_DESCRIPTION
- copyright = askbot_settings.APP_COPYRIGHT
+
+ def title(self):
+ return askbot_settings.APP_TITLE + _(' - ') + \
+ _('Individual question feed')
+
+ def feed_copyright(self):
+ return askbot_settings.APP_COPYRIGHT
+
+ def description(self):
+ return askbot_settings.APP_DESCRIPTION
def get_object(self, bits):
if len(bits) != 1:
raise ObjectDoesNotExist
return Post.objects.get_questions().get(id__exact = bits[0])
-
+
def item_link(self, item):
"""get full url to the item
"""
- return self.link + item.get_absolute_url()
+ return askbot_settings.APP_URL + item.get_absolute_url()
+
+ def link(self):
+ return askbot_settings.APP_URL
def item_pubdate(self, item):
"""get date of creation for the item
@@ -56,7 +65,7 @@ class RssIndividualQuestionFeed(Feed):
chain_elements.append(
Post.objects.get_comments().filter(parent=item)
)
-
+
answers = Post.objects.get_answers().filter(thread = item.thread)
for answer in answers:
chain_elements.append([answer,])
@@ -65,7 +74,7 @@ class RssIndividualQuestionFeed(Feed):
)
return itertools.chain(*chain_elements)
-
+
def item_title(self, item):
"""returns the title for the item
"""
@@ -77,7 +86,7 @@ class RssIndividualQuestionFeed(Feed):
elif item.post_type == "comment":
title = "Comment by %s for %s" % (item.author, self.title)
return title
-
+
def item_description(self, item):
"""returns the description for the item
"""
@@ -87,16 +96,24 @@ class RssIndividualQuestionFeed(Feed):
class RssLastestQuestionsFeed(Feed):
"""rss feed class for the latest questions
"""
- title = askbot_settings.APP_TITLE + _(' - ')+ _('latest questions')
- link = askbot_settings.APP_URL
- description = askbot_settings.APP_DESCRIPTION
- #ttl = 10
- copyright = askbot_settings.APP_COPYRIGHT
+
+ def title(self):
+ return askbot_settings.APP_TITLE + _(' - ') + \
+ _('Individual question feed')
+
+ def feed_copyright(self):
+ return askbot_settings.APP_COPYRIGHT
+
+ def description(self):
+ return askbot_settings.APP_DESCRIPTION
def item_link(self, item):
"""get full url to the item
"""
- return self.link + item.get_absolute_url()
+ return askbot_settings.APP_URL + item.get_absolute_url()
+
+ def link(self):
+ return askbot_settings.APP_URL
def item_author_name(self, item):
"""get name of author
@@ -117,10 +134,10 @@ class RssLastestQuestionsFeed(Feed):
"""returns url without the slug
because the slug can change
"""
- return self.link + item.get_absolute_url(no_slug = True)
-
+ return askbot_settings.APP_URL + item.get_absolute_url(no_slug = True)
+
def item_description(self, item):
- """returns the desciption for the item
+ """returns the description for the item
"""
return item.text
@@ -142,12 +159,12 @@ class RssLastestQuestionsFeed(Feed):
if tags:
#if there are tags in GET, filter the
#questions additionally
- for tag in tags:
+ for tag in tags:
qs = qs.filter(thread__tags__name = tag)
-
+
return qs.order_by('-thread__last_activity_at')[:30]
-
+
def main():
"""main function for use as a script
diff --git a/askbot/middleware/locale.py b/askbot/middleware/locale.py
new file mode 100644
index 00000000..c92e977a
--- /dev/null
+++ b/askbot/middleware/locale.py
@@ -0,0 +1,26 @@
+"Taken from django.middleware.locale: this is the locale selecting middleware that will look at accept headers"
+
+from django.utils.cache import patch_vary_headers
+from django.utils import translation
+from askbot.conf import settings
+
+class LocaleMiddleware(object):
+ """
+ This is a very simple middleware that parses a request
+ and decides what translation object to install in the current
+ thread context. This allows pages to be dynamically
+ translated to the language the user desires (if the language
+ is available, of course).
+ """
+
+ def process_request(self, request):
+ language = settings.ASKBOT_LANGUAGE
+ translation.activate(language)
+ request.LANGUAGE_CODE = translation.get_language()
+
+ def process_response(self, request, response):
+ patch_vary_headers(response, ('Accept-Language',))
+ if 'Content-Language' not in response:
+ response['Content-Language'] = translation.get_language()
+ translation.deactivate()
+ return response
diff --git a/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py b/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py
index d26bdeb0..70ef2f8d 100644
--- a/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py
+++ b/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py
@@ -5,7 +5,7 @@ from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
-
+
def forwards(self, orm):
# Removing unique constraint on 'BadgeData', fields ['type', 'name']
@@ -34,10 +34,10 @@ class Migration(SchemaMigration):
except:
db.rollback_transaction()
-
-
+
+
def backwards(self, orm):
-
+
# Adding field 'BadgeData.multiple'
db.add_column('askbot_badgedata', 'multiple', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default=False)
@@ -55,8 +55,8 @@ class Migration(SchemaMigration):
# Removing unique constraint on 'BadgeData', fields ['slug']
db.delete_unique('askbot_badgedata', ['slug'])
-
-
+
+
models = {
'askbot.activity': {
'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"},
@@ -335,5 +335,5 @@ class Migration(SchemaMigration):
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
}
}
-
+
complete_apps = ['askbot']
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index 191d13f3..b326ea85 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -98,6 +98,7 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES = (
#'django.middleware.gzip.GZipMiddleware',
+ 'askbot.middleware.locale.LocaleMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
#'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
index 3287fb18..eb1cb1c1 100644
--- a/askbot/setup_templates/settings.py.mustache
+++ b/askbot/setup_templates/settings.py.mustache
@@ -97,6 +97,7 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES = (
#'django.middleware.gzip.GZipMiddleware',
+ 'askbot.middleware.locale.LocaleMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
#'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
diff --git a/askbot/skins/default/media/style/lib_style.css b/askbot/skins/default/media/style/lib_style.css
new file mode 100644
index 00000000..a92af477
--- /dev/null
+++ b/askbot/skins/default/media/style/lib_style.css
@@ -0,0 +1,22 @@
+/* General Predifined classes, read more in lesscss.org */
+/* Variables for Colors*/
+/* Variables for fonts*/
+/* "Trebuchet MS", sans-serif;*/
+/* Buttons */
+.button-style-hover {
+ background-color: #cde5e9;
+ background-repeat: no-repeat;
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#cde5e9), color-stop(25%, #cde5e9), to(#94b3ba));
+ background-image: -webkit-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba);
+ background-image: -moz-linear-gradient(top, #cde5e9, #cde5e9 25%, #94b3ba);
+ background-image: -ms-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba);
+ background-image: -o-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba);
+ background-image: linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba);
+ text-decoration: none;
+ text-shadow: 0px 1px 0px #c6d9dd;
+ -moz-text-shadow: 0px 1px 0px #c6d9dd;
+ -webkit-text-shadow: 0px 1px 0px #c6d9dd;
+}
+/* General styles for gradients */
+/* Receive exactly positions for background Sprite */
+/* CSS3 Elements */
diff --git a/askbot/skins/default/media/style/lib_style.less b/askbot/skins/default/media/style/lib_style.less
index 941c83ff..bedd8c60 100644
--- a/askbot/skins/default/media/style/lib_style.less
+++ b/askbot/skins/default/media/style/lib_style.less
@@ -17,6 +17,43 @@
@main-font:'Yanone Kaffeesatz', sans-serif;
@secondary-font:Arial;
+/* Buttons */
+
+.button-style(@w:100px ,@h:20px, @f:14px){
+ width:@w;
+ height:@h;
+ font-size:@f;
+ text-align:center;
+ text-decoration:none;
+ cursor:pointer;
+ color:@button-label;
+ font-family:@main-font;
+ .text-shadow(0px,1px,0px,#c6d9dd);
+ border-top:#eaf2f3 1px solid;
+ .linear-gradient(#d1e2e5,#a9c2c7);
+ .rounded-corners(4px);
+ .box-shadow(1px, 1px, 2px, #636363)
+}
+
+.button-style-hover{
+ .linear-gradient(#cde5e9,#94b3ba);
+ text-decoration:none;
+ .text-shadow(0px, 1px, 0px, #c6d9dd);
+}
+
+/* General styles for gradients */
+
+.linear-gradient(@start:#eee,@end:#fff,@stop:25%){
+ background-color: @start;
+ background-repeat: no-repeat;
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@start), color-stop(@stop, @start), to(@end));
+ background-image: -webkit-linear-gradient(@start, @start @stop, @end);
+ background-image: -moz-linear-gradient(top, @start, @start @stop, @end);
+ background-image: -ms-linear-gradient(@start, @start @stop, @end);
+ background-image: -o-linear-gradient(@start, @start @stop, @end);
+ background-image: linear-gradient(@start, @start @stop, @end);
+}
+
/* Receive exactly positions for background Sprite */
.sprites(@hor,@vert,@back:url(../images/sprites.png)){
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index e63ff373..0d1e8112 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -154,6 +154,7 @@ h1 {
padding: 10px 0 5px 0px;
}
+
/* ----- Extra space above for messages ----- */
body.user-messages {
@@ -463,24 +464,15 @@ body.anon {
#askButton{ /* check blocks/secondary_header.html and widgets/ask_button.html*/
- background: url(../images/bigbutton.png) repeat-x bottom;
line-height:44px;
- text-align:center;
- width:200px;
- height:42px;
- font-size:23px;
- color:@button-label;
- margin-top:7px;
+ margin-top:6px;
float:right;
text-transform:uppercase;
- .rounded-corners(5px);
- .box-shadow(1px, 1px, 2px, #636363)
+ .button-style(200px, 42px, 23px);
}
#askButton:hover{
- text-decoration:none;
- background: url(../images/bigbutton.png) repeat-x top;
- .text-shadow(0px, 1px, 0px, #c6d9dd)
+ .button-style-hover;
}
/* ----- Content layout, check two_column_body.html or one_column_body.html ----- */
@@ -531,6 +523,7 @@ body.anon {
padding-right:10px;
margin-bottom:10px;
font-family:@main-font;
+ width:190px;
}
h3{
color:#4a757f;
@@ -590,23 +583,15 @@ body.anon {
height:25px;
}
#interestingTagAdd, #ignoredTagAdd{
- background:url(../images/small-button-blue.png) repeat-x top;
border:0;
- color:@button-label;
font-weight:bold;
- font-size:12px;
- width:30px;
- height:27px;
margin-top:-2px;
- cursor:pointer;
+ .button-style(30px,27px,12px);
.rounded-corners(4px);
- .text-shadow(0px,1px,0px,#E6F6FA);
- .box-shadow(1px, 1px, 2px, #808080);
-
-
+ .text-shadow(0px,1px,0px,#E6F6FA);
}
#interestingTagAdd:hover, #ignoredTagAdd:hover{
- background:url(../images/small-button-blue.png) repeat-x bottom;
+ .button-style-hover;
}
}
@@ -617,28 +602,17 @@ body.anon {
/* widgets for question template */
a.followed, a.follow{
- background: url(../images/medium-button.png) top repeat-x;
- height:34px;
line-height:34px;
- text-align:center;
border:0;
- font-family:@main-font;
- color:@button-label;
font-weight:normal;
- font-size:21px;
margin-top:3px;
-
display:block;
- width:120px;
- text-decoration:none;
- .rounded-corners(4px);
- .box-shadow(1px, 1px, 2px, #636363);
+ .button-style(120px,34px,21px);
.center;
}
a.followed:hover, a.follow:hover{
- text-decoration:none;
- background: url(../images/medium-button.png) bottom repeat-x;
+ .button-style-hover;
.text-shadow(0px, 1px, 0px, #c6d9dd);
}
@@ -1133,7 +1107,7 @@ ul#related-tags {
ul.tags li {
float:left;
display: block;
- margin: 0 8px 0 0;
+ margin: 0 8px 8px 0;
padding: 0;
height:20px;
}
@@ -1352,24 +1326,16 @@ ul#related-tags li {
.ask-page input.submit,
.edit-question-page input.submit {
float: left;
- background: url(../images/medium-button.png) top repeat-x;
- height:34px;
- border:0;
- font-family:@main-font;
- color:@button-label;
font-weight:normal;
- font-size:21px;
margin-top:3px;
- .rounded-corners(4px);
- .box-shadow(1px, 1px, 2px, #636363);
+ .button-style(160px,34px,21px);
margin-right:7px;
}
#fmanswer input.submit:hover,
.ask-page input.submit:hover,
.edit-question-page input.submit:hover{
- text-decoration:none;
- background: url(../images/medium-button.png) bottom repeat-x;
+ .button-style-hover;
.text-shadow(0px, 1px, 0px, #c6d9dd)
}
#editor { /*adjustment for editor preview*/
@@ -1383,7 +1349,13 @@ ul#related-tags li {
border-top:0;
padding:10px;
margin-bottom:10px;
- width:717px;
+ width:710px;
+}
+
+@media screen and (-webkit-min-device-pixel-ratio:0){
+ #editor{
+ width:717px;
+ }
}
#id_title {
@@ -1796,24 +1768,14 @@ ul#related-tags li {
width: 100px;
}
button{
- background:url(../images/small-button-blue.png) repeat-x top;
- border:0;
- color:@button-label;
- font-family:@body-font;
- font-size:13px;
- width:100px;
- font-weight:bold;
- height:27px;
line-height:25px;
margin-bottom:5px;
- cursor:pointer;
- .rounded-corners(4px);
- .text-shadow(0px,1px,0px,#E6F6FA);
- .box-shadow(1px, 1px, 2px, #808080);
+ .button-style(100px,27px,12px);
+ font-family:@body-font;
+ font-weight:bold;
}
button:hover{
- background: url(../images/small-button-blue.png) bottom repeat-x;
- .text-shadow(0px, 1px, 0px, #c6d9dd);
+ .button-style-hover;
}
.counter {
display: inline-block;
@@ -1958,6 +1920,10 @@ ul#related-tags li {
text-align: center;
padding-top: 2px;
margin:10px 10px 0px 3px;
+ /* smalls IE fixes */
+ *margin:0;
+ *height:210px;
+ *width:30px;
}
.vote-buttons IMG {
@@ -2155,23 +2121,13 @@ ul#related-tags li {
font-size:14px;
}
input.submit{
- background:url(../images/small-button-blue.png) repeat-x top;
- border:0;
- color:@button-label;
- font-weight:bold;
- font-size:13px;
- font-family:@body-font;
- height:26px;
+ font-weight:normal;
margin:5px 0px;
- width:100px;
- cursor:pointer;
- .rounded-corners(4px);
- .text-shadow(0px,1px,0px,#E6F6FA);
- .box-shadow(1px, 1px, 2px, #808080);
+ .button-style(100px,26px,15px);
+ font-family:@body-font;
}
input.submit:hover{
- background:url(../images/small-button-blue.png) repeat-x bottom;
- text-decoration:none;
+ .button-style-hover;
}
.cancel{
background:url(../images/small-button-cancel.png) repeat-x top !important;
@@ -2194,25 +2150,19 @@ ul#related-tags li {
width:200px;
}
.submit-b{
- background:url(../images/small-button-blue.png) repeat-x top;
- border:0;
- color:@button-label;
- font-weight:bold;
- font-size:13px;
+ .button-style(100px,24px,15px);
font-family:@body-font;
- height:24px;
- margin-top:-2px;
- padding-left:10px;
+ font-weight:bold;
padding-right:10px;
- cursor:pointer;
- .rounded-corners(4px);
- .text-shadow(0px,1px,0px,#E6F6FA);
- .box-shadow(1px, 1px, 2px, #808080)
+ border:0;
}
+
.submit-b:hover{
- background:url(../images/small-button-blue.png) repeat-x bottom;
+ .button-style-hover;
}
}
+
+
.openid-input {
background: url(../images/openid.gif) no-repeat;
padding-left: 15px;
@@ -2357,23 +2307,14 @@ a:hover.medal {
.follow-toggle,.submit {
border:0 !important;
- color:@button-label;
font-weight:bold;
- font-size:12px;
- height:26px;
line-height:26px;
margin-top:-2px;
- font-size:15px;
- cursor:pointer;
- font-family:@main-font;
- background:url(../images/small-button-blue.png) repeat-x top;
- .rounded-corners(4px);
- .text-shadow(0px,1px,0px,#E6F6FA);
- .box-shadow(1px, 1px, 2px, #808080)
+ .button-style(100px,26px,12px);
}
.follow-toggle:hover, .submit:hover {
- background:url(../images/small-button-blue.png) repeat-x bottom;
+ .button-style-hover;
text-decoration:none !important;
}
@@ -3383,3 +3324,12 @@ body.anon.lang-es {
}
}
}
+a.re_expand{
+ color: #616161;
+ text-decoration:none;
+}
+
+a.re_expand .re_content{
+ display:none;
+ margin-left:77px;
+}
diff --git a/askbot/skins/default/templates/main_page/tab_bar.html b/askbot/skins/default/templates/main_page/tab_bar.html
index 8b666155..17ab810e 100644
--- a/askbot/skins/default/templates/main_page/tab_bar.html
+++ b/askbot/skins/default/templates/main_page/tab_bar.html
@@ -3,9 +3,9 @@
{% cache 0 "scope_sort_tabs" search_tags request.user author_name scope sort query context.page language_code %}
<a class="rss"
{% if feed_url %}
- href="{{settings.APP_URL}}{{feed_url}}"
+ href="{{feed_url}}"
{% else %}
- href="{{settings.APP_URL}}/feeds/rss/"
+ href="/feeds/rss/"
{% endif %}
title="{% trans %}subscribe to the questions feed{% endtrans %}"
>{% trans %}RSS{% endtrans %}
diff --git a/askbot/skins/default/templates/question/question_card.html b/askbot/skins/default/templates/question/question_card.html
index 08f7ccee..dd52ea0f 100644
--- a/askbot/skins/default/templates/question/question_card.html
+++ b/askbot/skins/default/templates/question/question_card.html
@@ -29,4 +29,4 @@
</div>
</div>
-<div class="clean"></div>
+
diff --git a/askbot/skins/utils.py b/askbot/skins/utils.py
index a07b1fa9..4f8e1992 100644
--- a/askbot/skins/utils.py
+++ b/askbot/skins/utils.py
@@ -3,7 +3,7 @@
the lookup resolution process for templates and media works as follows:
* look up item in selected skin
* if not found look in 'default'
-* raise an exception
+* raise an exception
"""
import os
import logging
@@ -56,7 +56,7 @@ def get_available_skins(selected=None):
#re-insert default as a last item
skins['default'] = default_dir
- skins['common'] = common_dir
+ skins['common'] = common_dir
return skins
@@ -71,7 +71,7 @@ def get_path_to_skin(skin):
return skin_dirs.get(skin, None)
def get_skin_choices():
- """returns a tuple for use as a set of
+ """returns a tuple for use as a set of
choices in the form"""
skin_names = list(reversed(get_available_skins().keys()))
return zip(skin_names, skin_names)
@@ -86,7 +86,7 @@ def resolve_skin_for_media(media=None, preferred_skin = None):
def get_media_url(url, ignore_missing = False):
"""returns url prefixed with the skin name
- of the first skin that contains the file
+ of the first skin that contains the file
directories are searched in this order:
askbot_settings.ASKBOT_DEFAULT_SKIN, then 'default', then 'commmon'
if file is not found - returns None
@@ -156,7 +156,7 @@ def get_media_url(url, ignore_missing = False):
url = django_settings.STATIC_URL + use_skin + '/media/' + url
url = os.path.normpath(url).replace('\\', '/')
-
+
if resource_revision:
url += '?v=%d' % resource_revision
@@ -174,7 +174,7 @@ def update_media_revision(skin = None):
if skin in get_skin_choices():
skin_path = get_path_to_skin(skin)
else:
- raise MediaNotFound('Skin %s not found' % skin)
+ raise MediaNotFound('Skin %s not found' % skin)
else:
skin = 'default'
skin_path = get_path_to_skin(askbot_settings.ASKBOT_DEFAULT_SKIN)
@@ -192,7 +192,25 @@ def update_media_revision(skin = None):
current_hash = hasher.get_hash_of_dirs(media_dirs)
if current_hash != askbot_settings.MEDIA_RESOURCE_REVISION_HASH:
- askbot_settings.update('MEDIA_RESOURCE_REVISION', resource_revision + 1)
- askbot_settings.update('MEDIA_RESOURCE_REVISION_HASH', current_hash)
+ try:
+ askbot_settings.update('MEDIA_RESOURCE_REVISION', resource_revision + 1)
+ logging.debug('media revision worked for MEDIA_RESOURCE_REVISION')
+ except Exception, e:
+ logging.critical(e.message)
+ safe_settings_update('MEDIA_RESOURCE_REVISION', resource_revision + 1)
+
+ try:
+ askbot_settings.update('MEDIA_RESOURCE_REVISION_HASH', current_hash)
+ logging.debug('media revision worked for MEDIA_RESOURCE_REVISION_HASH')
+ except Exception, e:
+ logging.critical(e.message)
+ safe_settings_update('MEDIA_RESOURCE_REVISION_HASH', current_hash)
logging.debug('MEDIA_RESOURCE_REVISION changed')
- askbot_settings.MEDIA_RESOURCE_REVISION
+
+
+def safe_settings_update(key, value):
+ '''Fallback when IntegrityError bug raises'''
+ from askbot.deps.livesettings.models import Setting
+ setting = Setting.objects.get(key=key)
+ setting.value = value
+ setting.save()
diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py
index 9678fdf1..618f1ed7 100644
--- a/askbot/startup_procedures.py
+++ b/askbot/startup_procedures.py
@@ -11,7 +11,8 @@ import sys
import os
import re
import askbot
-from django.db import transaction
+import south
+from django.db import transaction, connection
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
from askbot.utils.loading import load_module
@@ -166,7 +167,7 @@ def try_import(module_name, pypi_package_name, short_message = False):
try:
load_module(module_name)
except ImportError, error:
- message = 'Error: ' + unicode(error)
+ message = 'Error: ' + unicode(error)
message += '\n\nPlease run: >pip install %s' % pypi_package_name
if short_message == False:
message += '\n\nTo install all the dependencies at once, type:'
@@ -306,10 +307,10 @@ class SettingsTester(object):
)
if len(self.messages) != 0:
raise AskbotConfigError(
- '\n\nTime to do some maintenance of your settings.py:\n\n* ' +
+ '\n\nTime to do some maintenance of your settings.py:\n\n* ' +
'\n\n* '.join(self.messages)
)
-
+
def test_staticfiles():
"""tests configuration of the staticfiles app"""
errors = list()
@@ -350,7 +351,7 @@ def test_staticfiles():
if static_url is None or str(static_url).strip() == '':
errors.append(
'Add STATIC_URL setting to your settings.py file. '
- 'The setting must be a url at which static files '
+ 'The setting must be a url at which static files '
'are accessible.'
)
url = urlparse(static_url).path
@@ -407,7 +408,7 @@ def test_staticfiles():
' python manage.py collectstatic\n'
)
-
+
print_errors(errors)
if django_settings.STATICFILES_STORAGE == \
'django.contrib.staticfiles.storage.StaticFilesStorage':
@@ -479,8 +480,6 @@ def test_avatar():
'-e git+git://github.com/ericflo/django-avatar.git#egg=avatar',
short_message = True
)
-
-
def run_startup_tests():
"""function that runs
@@ -497,7 +496,11 @@ def run_startup_tests():
test_celery()
#test_csrf_cookie_domain()
test_staticfiles()
+<<<<<<< HEAD
+ test_mysql_south_bug()
+=======
test_avatar()
+>>>>>>> 64ab1ac2d8cfe57e524aca3341abc852b861e512
settings_tester = SettingsTester({
'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': {
'value': True,