Skip to content

Commit 963a0c2

Browse files
committed
Merge branch '0.11.x' into pr-849-wip
2 parents 618342a + 4c7cfa9 commit 963a0c2

25 files changed

+511
-185
lines changed

askbot/conf/email.py

+27-30
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '')
1414

1515
EMAIL = livesettings.ConfigurationGroup(
16-
'EMAIL',
17-
_('Email and email alert settings'),
18-
super_group=LOGIN_USERS_COMMUNICATION
19-
)
16+
'EMAIL',
17+
_('Email and email alert settings'),
18+
super_group=LOGIN_USERS_COMMUNICATION
19+
)
2020

2121
settings.register(
2222
livesettings.StringValue(
@@ -25,18 +25,18 @@
2525
default=EMAIL_SUBJECT_PREFIX,
2626
description=_('Prefix for the email subject line'),
2727
help_text=_(
28-
'This setting takes default from the django setting '
29-
'EMAIL_SUBJECT_PREFIX. A value entered here will override '
30-
'the default.'
31-
)
28+
'This setting takes default from the django setting '
29+
'EMAIL_SUBJECT_PREFIX. A value entered here will override '
30+
'the default.'
31+
)
3232
)
3333
)
3434

3535

3636
def get_default_admin_email():
3737
try:
3838
return django_settings.ADMINS[0][1]
39-
except:
39+
except (AttributeError, IndexError):
4040
return ''
4141

4242
settings.register(
@@ -148,8 +148,6 @@ def get_default_admin_email():
148148
default='w',
149149
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
150150
description=_('Default notification frequency all questions'),
151-
help_text=_('Option to define frequency of emailed updates for: '
152-
'all questions.')
153151
)
154152
)
155153

@@ -160,9 +158,7 @@ def get_default_admin_email():
160158
default='i',
161159
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
162160
description=_('Default notification frequency questions asked by the '
163-
'user'),
164-
help_text=_('Option to define frequency of emailed updates for: '
165-
'Question asked by the user.')
161+
'user')
166162
)
167163
)
168164

@@ -173,9 +169,17 @@ def get_default_admin_email():
173169
default='d',
174170
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
175171
description=_('Default notification frequency questions answered by '
176-
'the user'),
177-
help_text=_('Option to define frequency of emailed updates for: '
178-
'Question answered by the user.')
172+
'the user')
173+
)
174+
)
175+
176+
settings.register(
177+
livesettings.StringValue(
178+
EMAIL,
179+
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_NOANS',
180+
default='n',
181+
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES_Q_NOANS,
182+
description=_('Default notification frequency on unanswered questions')
179183
)
180184
)
181185

@@ -185,10 +189,8 @@ def get_default_admin_email():
185189
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_SEL',
186190
default='i',
187191
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
188-
description=_('Default notification frequency questions individually \
189-
selected by the user'),
190-
help_text=_('Option to define frequency of emailed updates for: '
191-
'Question individually selected by the user.')
192+
description=_('Default notification frequency questions individually'
193+
'selected by the user')
192194
)
193195
)
194196

@@ -198,10 +200,8 @@ def get_default_admin_email():
198200
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_M_AND_C',
199201
default='i',
200202
choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
201-
description=_('Default notification frequency for mentions \
202-
and comments'),
203-
help_text=_('Option to define frequency of emailed updates for: '
204-
'Mentions and comments.')
203+
description=_('Default notification frequency for mentions'
204+
'and comments')
205205
)
206206
)
207207

@@ -351,13 +351,10 @@ def get_default_admin_email():
351351
livesettings.BooleanValue(
352352
EMAIL,
353353
'REPLY_BY_EMAIL',
354-
default = False,
354+
default=False,
355355
description=_('Enable posting and replying by email'),
356356
#TODO give a better explanation depending on lamson startup procedure
357-
help_text=_(
358-
'To enable this feature make sure lamson is running'
359-
360-
)
357+
help_text=_('To enable this feature make sure lamson is running')
361358
)
362359
)
363360

askbot/conf/social_sharing.py

-9
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,3 @@
7171
description=_('Check to enable sharing of questions on Identi.ca')
7272
)
7373
)
74-
75-
settings.register(
76-
BooleanValue(
77-
SOCIAL_SHARING,
78-
'ENABLE_SHARING_GOOGLE',
79-
default=True,
80-
description=_('Check to enable sharing of questions on Google+')
81-
)
82-
)

askbot/conf/static_settings.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.conf import settings
22
from django.utils.translation import pgettext
3+
from django.utils import timezone
34
from appconf import AppConf
45
import os
56
from askbot import const
@@ -28,6 +29,10 @@ class AskbotStaticSettings(AppConf):
2829
'tinymce': 'askbot.utils.markup.tinymce_input_converter',
2930
}
3031

32+
# only report on updates after this date, useful when
33+
# enabling delayed email alerts on a site with a lot of content
34+
# in order to prevent sending too many outdated alerts
35+
DELAYED_EMAIL_ALERTS_CUTOFF_TIMESTAMP = timezone.datetime.fromtimestamp(0)
3136
QUESTION_PAGE_BASE_URL = pgettext('urls', 'question') + '/'
3237
SERVICE_URL_PREFIX = 's/' # prefix for non-UI urls
3338
SELF_TEST = True # if true - run startup self-test

askbot/const/__init__.py

+51-54
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
For reasons that models, views can't have unicode
55
text in this project, all unicode text go here.
66
"""
7-
from django.utils.translation import ugettext_lazy as _
87
import os
98
import re
9+
from django.utils.translation import ugettext_lazy as _
1010
from askbot import get_install_directory
11+
#an exception import * because that file has only strings
12+
from askbot.const.message_keys import * #pylint: disable=wildcard-import
1113

1214
DEFAULT_USER_DATA_EXPORT_DIR = os.path.abspath(
13-
os.path.join(get_install_directory(),
14-
'..',
15-
'user_data')
16-
)
15+
os.path.join(get_install_directory(), '..', 'user_data'))
1716

1817
#todo: customize words
1918
CLOSE_REASONS = (
@@ -116,7 +115,7 @@
116115
REPLY_SEPARATOR_REGEX = re.compile(r'==== .* -=-==', re.MULTILINE|re.DOTALL)
117116

118117
ANSWER_SORT_METHODS = (
119-
('latest' , _('latest first')),
118+
('latest', _('latest first')),
120119
('oldest', _('oldest first')),
121120
('votes', _('most voted first')),
122121
)
@@ -313,15 +312,15 @@
313312
TYPE_ACTIVITY_UPDATE_ANSWER,
314313
TYPE_ACTIVITY_UPDATE_QUESTION,
315314
TYPE_ACTIVITY_POST_SHARED,
316-
# TYPE_ACTIVITY_PRIZE,
317-
# TYPE_ACTIVITY_MARK_ANSWER,
318-
# TYPE_ACTIVITY_VOTE_UP,
319-
# TYPE_ACTIVITY_VOTE_DOWN,
320-
# TYPE_ACTIVITY_CANCEL_VOTE,
321-
# TYPE_ACTIVITY_DELETE_QUESTION,
322-
# TYPE_ACTIVITY_DELETE_ANSWER,
323-
# TYPE_ACTIVITY_MARK_OFFENSIVE,
324-
# TYPE_ACTIVITY_FAVORITE,
315+
# TYPE_ACTIVITY_PRIZE,
316+
# TYPE_ACTIVITY_MARK_ANSWER,
317+
# TYPE_ACTIVITY_VOTE_UP,
318+
# TYPE_ACTIVITY_VOTE_DOWN,
319+
# TYPE_ACTIVITY_CANCEL_VOTE,
320+
# TYPE_ACTIVITY_DELETE_QUESTION,
321+
# TYPE_ACTIVITY_DELETE_ANSWER,
322+
# TYPE_ACTIVITY_MARK_OFFENSIVE,
323+
# TYPE_ACTIVITY_FAVORITE,
325324
)
326325

327326
RESPONSE_ACTIVITY_TYPE_MAP_FOR_TEMPLATES = {
@@ -467,31 +466,35 @@
467466
)
468467

469468
NOTIFICATION_DELIVERY_SCHEDULE_CHOICES = (
470-
('i',_('instantly')),
471-
('d',_('daily')),
472-
('w',_('weekly')),
473-
('n',_('never')),
474-
)
469+
('i', _('instantly')),
470+
('d', _('daily')),
471+
('w', _('weekly')),
472+
('n', _('never')),
473+
)
474+
475+
NOTIFICATION_DELIVERY_SCHEDULE_CHOICES_Q_NOANS = (
476+
('d', _('daily')),
477+
('w', _('weekly')),
478+
('n', _('never')),
479+
)
475480

476481
USERNAME_REGEX_STRING = r'^[\w \-.@+\']+$'
477482

478-
GRAVATAR_TYPE_CHOICES = (
479-
('identicon',_('identicon')),
480-
('monsterid',_('monsterid')),
481-
('wavatar',_('wavatar')),
482-
('retro',_('retro')),
483-
('mm',_('mystery-man')),
484-
)
483+
GRAVATAR_TYPE_CHOICES = (('identicon', _('identicon')),
484+
('monsterid', _('monsterid')),
485+
('wavatar', _('wavatar')),
486+
('retro', _('retro')),
487+
('mm', _('mystery-man')))
485488

486489
AVATAR_TYPE_CHOICES_FOR_NEW_USERS = (
487490
('n', _('Default avatar')),
488491
('g', _('Gravatar')),#only if user has real uploaded gravatar
489492
)
490493

491494
AVATAR_TYPE_CHOICES = AVATAR_TYPE_CHOICES_FOR_NEW_USERS + (
492-
#avatar uploaded locally - with django-avatar app
493-
('a', _('Uploaded Avatar')),
494-
)
495+
#avatar uploaded locally - with django-avatar app
496+
('a', _('Uploaded Avatar')),
497+
)
495498

496499
#chars that can go before or after @mention
497500
TWITTER_STYLE_MENTION_TERMINATION_CHARS = '\n ;:,.!?<>"\''
@@ -500,12 +503,12 @@
500503

501504
#user status ch
502505
USER_STATUS_CHOICES = (
503-
('d', _('administrator')), #admin = moderator + access to settings
504-
('m', _('moderator')), #user with moderation privilege
505-
('a', _('approved')), #regular user
506-
('w', _('watched')), #regular user placed on the moderation watch
507-
('s', _('suspended')), #suspended user who cannot post new stuff
508-
('b', _('blocked')), #blocked
506+
('d', _('administrator')), #admin = moderator + access to settings
507+
('m', _('moderator')), #user with moderation privilege
508+
('a', _('approved')), #regular user
509+
('w', _('watched')), #regular user placed on the moderation watch
510+
('s', _('suspended')), #suspended user who cannot post new stuff
511+
('b', _('blocked')), #blocked
509512
)
510513
DEFAULT_USER_STATUS = 'w'
511514

@@ -539,11 +542,10 @@
539542
GOLD_BADGE = 1
540543
SILVER_BADGE = 2
541544
BRONZE_BADGE = 3
542-
BADGE_TYPE_CHOICES = (
543-
(GOLD_BADGE, _('gold')),
544-
(SILVER_BADGE, _('silver')),
545-
(BRONZE_BADGE, _('bronze')),
546-
)
545+
BADGE_TYPE_CHOICES = ((GOLD_BADGE, _('gold')),
546+
(SILVER_BADGE, _('silver')),
547+
(BRONZE_BADGE, _('bronze')))
548+
547549
BADGE_CSS_CLASSES = {
548550
GOLD_BADGE: 'badge1',
549551
SILVER_BADGE: 'badge2',
@@ -553,16 +555,14 @@
553555

554556
MIN_REPUTATION = 1
555557

556-
SEARCH_ORDER_BY = (
557-
('-added_at', _('date descendant')),
558-
('added_at', _('date ascendant')),
559-
('-last_activity_at', _('most recently active')),
560-
('last_activity_at', _('least recently active')),
561-
('-answer_count', _('more responses')),
562-
('answer_count', _('fewer responses')),
563-
('-points', _('more votes')),
564-
('points', _('less votes')),
565-
)
558+
SEARCH_ORDER_BY = (('-added_at', _('date descendant')),
559+
('added_at', _('date ascendant')),
560+
('-last_activity_at', _('most recently active')),
561+
('last_activity_at', _('least recently active')),
562+
('-answer_count', _('more responses')),
563+
('answer_count', _('fewer responses')),
564+
('-points', _('more votes')),
565+
('points', _('less votes')))
566566

567567
DEFAULT_QUESTION_WIDGET_STYLE = """
568568
@import url('http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:300,400,700');
@@ -594,6 +594,3 @@
594594
font-size: 15px;
595595
}
596596
"""
597-
598-
#an exception import * because that file has only strings
599-
from askbot.const.message_keys import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.5 on 2019-09-11 07:35
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('django_authopenid', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='userassociation',
15+
name='provider_name',
16+
field=models.CharField(default='unknown', max_length=64),
17+
),
18+
]

askbot/deps/django_authopenid/views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,8 @@ def verify_email_and_register(request):
13071307
cleanup_post_register_session(request)
13081308

13091309
return HttpResponseRedirect(get_next_url(request))
1310-
except Exception as e:
1310+
except Exception as error:
1311+
logging.critical('Could not verify account: %s', unicode(error).encode('utf-8'))
13111312
message = _(
13121313
'Sorry, registration failed. '
13131314
'The token can be already used or has expired. Please try again'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Generated by Django 2.2.5 on 2019-09-11 07:35
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('group_messaging', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='message',
15+
name='html',
16+
field=models.TextField(blank=True, help_text='rendered html of the message', null=True),
17+
),
18+
migrations.AlterField(
19+
model_name='message',
20+
name='message_type',
21+
field=models.SmallIntegerField(choices=[(0, 'email-like message, stored in the inbox'), (2, 'will be shown just once'), (1, 'will be shown until certain time')], default=0),
22+
),
23+
migrations.AlterField(
24+
model_name='message',
25+
name='senders_info',
26+
field=models.TextField(default=''),
27+
),
28+
migrations.AlterField(
29+
model_name='message',
30+
name='text',
31+
field=models.TextField(blank=True, help_text='source text for the message, e.g. in markdown format', null=True),
32+
),
33+
migrations.AlterField(
34+
model_name='messagememo',
35+
name='status',
36+
field=models.SmallIntegerField(choices=[(0, 'seen'), (1, 'archived'), (2, 'deleted')], default=0),
37+
),
38+
]

0 commit comments

Comments
 (0)