app/soc/tasks/start.py
author Sverre Rabbelier <srabbelier@gmail.com>
Sat, 12 Sep 2009 00:59:58 +0200 (2009-09-11)
changeset 2899 691735924efb
parent 2882 3fbbb56b7925
permissions -rw-r--r--
Fix broken maintenance mode Maintenance mode has been broken since r7fe19ebfe0d3 (Thu Jun 4) "Display caught errors on the page itself", fix it by passing the site entity, rather than the site module to isActivePeriod.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2882
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""Tasks conversion starter.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from django import http
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from django.template import loader
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
from soc.tasks import convert
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
def getDjangoURLPatterns():
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
  """Returns the URL patterns for the view in this module.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  """
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  patterns = [(r'tasks/start$',
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
               'soc.tasks.start.startTasks')]
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
  return patterns
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
def startTasks(request):
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  """Presents a view that allows the user to start conversion tasks.
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
  """
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  template = 'soc/tasks/start.html'
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
  context = {
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
      'page_name': 'Task starter',
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
      'options': convert.runner.getOptions(),
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
    }
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
  content = loader.render_to_string(template, dictionary=context)
3fbbb56b7925 Add a view to start conversion tasks
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
  return http.HttpResponse(content)