app/soc/tasks/updates/start_update.py
author Lennard de Rijk <ljvderijk@gmail.com>
Tue, 15 Sep 2009 22:23:06 +0200
changeset 2928 76d5782542dd
parent 2925 d1de20978875
child 2931 e89022c0657f
permissions -rw-r--r--
Changed the TaskRunner to start and run update tasks. Also changed the way the different updates are defined as to comments received on r2ddd386d1d.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    17
"""Version update Tasks runner.
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
  ]
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from django import http
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
from django.template import loader
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    30
from soc.tasks.helper import error_handler
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
from soc.views.helper import responses
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
def getDjangoURLPatterns():
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
  """Returns the URL patterns for the views in this module.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
2925
d1de20978875 Moved the updater to its own module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2911
diff changeset
    38
  patterns = [
d1de20978875 Moved the updater to its own module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2911
diff changeset
    39
      (r'tasks/update/start$', 'soc.tasks.updates.start_update.startTasks'),
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    40
      (r'tasks/update/start/([a-z]+)$',
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    41
       'soc.tasks.updates.start_update.start_task'),
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    42
      (r'tasks/update/run/([a-z]+)$',
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    43
       'soc.tasks.updates.start_update.run_task')]
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
  return patterns
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    46
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
def startTasks(request):
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    49
  """Presents a view that allows the user to start update tasks.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    50
  """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    51
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    52
  template = 'soc/tasks/start_update.html'
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    53
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    54
  context = responses.getUniversalContext(request)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    55
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    56
  options = task_runner.getOptions()
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
  sorted_keys = []
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    59
  for key, option in options.iteritems():
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    60
    option['name'] = key
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    61
    sorted_keys.append(
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    62
        (option['from_version'], option['in_version_order'], key))
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    63
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    64
  # sort the keys
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    65
  sorted_keys.sort()
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    66
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    67
  # store only the true option
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    68
  sorted_options = []
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    69
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    70
  for key_tuple in sorted_keys:
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    71
    option_key = key_tuple[2]
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
    sorted_options.append(options[option_key])
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    73
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    74
  context.update(
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    75
      page_name='Update Tasks starter',
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    76
      options=sorted_options,
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    77
      )
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    78
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    79
  content = loader.render_to_string(template, dictionary=context)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    80
  return http.HttpResponse(content)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    81
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    82
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    83
class TaskRunner(object):
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    84
  """Runs one of the supported tasks.
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    85
  """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    86
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    87
  ORG_CONVERSION = {
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    88
      'from_version': 'V-2',
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    89
      'in_version_order': 1,
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    90
      'description': ugettext('This converts the Organization models to contain X,Y,Z.'),
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    91
      'starter': lambda x:False,
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    92
      'runner': lambda x,**kwargs:http.HttpResponse('TEST OK'),
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    93
      }
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    94
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
    95
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    96
  def __init__(self):
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    97
    """Initializes the TaskRunner.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    98
    """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    99
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   100
    self.options = {
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   101
        'organization': self.ORG_CONVERSION,
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   102
    }
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   103
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   104
  def getOptions(self):
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   105
    """Returns the supported options.
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   106
    """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   107
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   108
    return self.options
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   109
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   110
  def startTask(self, request, option):
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   111
    """Starts the specified Task for the given option.
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   112
    """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   113
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   114
    context = responses.getUniversalContext(request)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   115
    context['page_name'] = 'Start Update Task'
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   116
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   117
    option = self.options.get(option)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   118
    if not option:
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   119
      template = 'soc/error.html'
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   120
      context['message'] = 'Uknown option "%s".' % option
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   121
    else:
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   122
      template = 'soc/tasks/run_update.html'
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   123
      context['option'] = option
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   124
      context['success'] = option['starter'](request)
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   125
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   126
    content = loader.render_to_string(template, dictionary=context)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   127
    return http.HttpResponse(content)
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   128
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   129
  def runTask(self, request, option, **kwargs):
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   130
    """Runs the specified Task for the given option.
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   131
    """
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   132
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   133
    option = self.options.get(option)
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   134
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   135
    if not option:
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   136
      error_handler('Uknown Updater option "%s".' % option)
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   137
    else:
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   138
      return option['runner'](request, **kwargs)
2911
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   139
2ddd386d1dbd Changed the conversion starter system to an update starter system.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   140
2928
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   141
task_runner = TaskRunner()
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   142
start_task = task_runner.startTask
76d5782542dd Changed the TaskRunner to start and run update tasks.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2925
diff changeset
   143
run_task = task_runner.runTask