summaryrefslogtreecommitdiffstats
path: root/askbot/management
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-26 23:17:10 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-26 23:17:10 -0400
commit337302e494329a2387262a40efc538dc2a620ee3 (patch)
treee64792623ff426d08a8bbf46f2630cf3d2d007a2 /askbot/management
parent41a23a3a8e9adaf1b877c49f8d0d5eab007ae693 (diff)
downloadaskbot-337302e494329a2387262a40efc538dc2a620ee3.tar.gz
askbot-337302e494329a2387262a40efc538dc2a620ee3.tar.bz2
askbot-337302e494329a2387262a40efc538dc2a620ee3.zip
broken commit - migration 137 fails!
Diffstat (limited to 'askbot/management')
-rw-r--r--askbot/management/commands/askbot_add_test_content.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/askbot/management/commands/askbot_add_test_content.py b/askbot/management/commands/askbot_add_test_content.py
index ca250339..888f7df0 100644
--- a/askbot/management/commands/askbot_add_test_content.py
+++ b/askbot/management/commands/askbot_add_test_content.py
@@ -2,6 +2,7 @@ from django.core.management.base import NoArgsCommand
from askbot.models import User
from optparse import make_option
from askbot.utils.console import choice_dialog
+from askbot.conf import settings as askbot_settings
NUM_USERS = 40
@@ -34,6 +35,13 @@ ANSWER_TEMPLATE = BAD_STUFF + """Accelerator photo sharing business school drop
COMMENT_TEMPLATE = BAD_STUFF + """Main differentiators business model micro economics
marketplace equity augmented reality human computer"""
+ALERT_SETTINGS_KEYS = (
+ 'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ASK',
+ 'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ANS',
+ 'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ALL',
+ 'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_SEL',
+ 'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_M_AND_C',
+)
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
@@ -41,6 +49,20 @@ class Command(NoArgsCommand):
help='Do not prompt the user for input of any kind.'),
)
+ def save_alert_settings(self):
+ settings = {}
+ for key in ALERT_SETTINGS_KEYS:
+ settings[key] = getattr(askbot_settings, key)
+ self.alert_settings = settings
+
+ def stop_alerts(self):
+ for key in ALERT_SETTINGS_KEYS:
+ askbot_settings.update(key, 'n')
+
+ def restore_saved_alert_settings(self):
+ for key in ALERT_SETTINGS_KEYS:
+ askbot_settings.update(key, self.alert_settings[key])
+
def print_if_verbose(self, text):
"Only print if user chooses verbose output"
if self.verbosity > 0:
@@ -207,7 +229,8 @@ class Command(NoArgsCommand):
if answer != "yes":
return
-
+ self.save_alert_settings()
+ self.stop_alerts()# saves time on running the command
# Create Users
users = self.create_users()
@@ -259,4 +282,6 @@ class Command(NoArgsCommand):
)
self.print_if_verbose("User has accepted a best answer")
+ self.restore_saved_alert_settings()
+
self.print_if_verbose("DONE")