Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrodob committed Apr 14, 2015
1 parent d6377aa commit df756da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pybossa/forms/forms.py
Expand Up @@ -103,10 +103,9 @@ class TaskSchedulerForm(Form):
sched = SelectField(lazy_gettext('Task Scheduler'), choices=_choices)

@classmethod
def refresh_sched_options(cls):
from pybossa.sched import sched_variants
def update_sched_options(cls, new_options):
_translate_names = lambda variant: (variant[0], lazy_gettext(variant[1]))
_choices = map(_translate_names, sched_variants())
_choices = map(_translate_names, new_options)
cls.sched.kwargs['choices'] = _choices


Expand Down
2 changes: 1 addition & 1 deletion pybossa/plugins/random_scheduler/__init__.py
Expand Up @@ -40,4 +40,4 @@ class RandomScheduler(Plugin):
def setup(self):
sched.new_task = with_random_scheduler(sched.new_task)
sched.sched_variants = variants_with_random_scheduler(sched.sched_variants)
TaskSchedulerForm.refresh_sched_options()
TaskSchedulerForm.update_sched_options(sched.sched_variants())

0 comments on commit df756da

Please sign in to comment.