PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/appengine_django/management/commands/rollback.py

http://google-app-engine-django.googlecode.com/
Python | 52 lines | 18 code | 11 blank | 23 comment | 2 complexity | fb4408ea08887717acd7d231adbb2c4c MD5 | raw file
 1#!/usr/bin/python2.4
 2#
 3# Copyright 2008 Google Inc.
 4#
 5# Licensed under the Apache License, Version 2.0 (the "License");
 6# you may not use this file except in compliance with the License.
 7# You may obtain a copy of the License at
 8#
 9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
18import sys
19import logging
20
21from django.core.management.base import BaseCommand
22
23
24def run_appcfg():
25  # import this so that we run through the checks at the beginning
26  # and report the appropriate errors
27  import appcfg
28
29  # We don't really want to use that one though, it just executes this one
30  from google.appengine.tools import appcfg
31  
32  # Reset the logging level to WARN as appcfg will spew tons of logs on INFO
33  logging.getLogger().setLevel(logging.WARN)
34
35  # Note: if we decide to change the name of this command to something other
36  #       than 'rollback' we will have to munge the args to replace whatever
37  #       we called it with 'rollback'
38  new_args = sys.argv[:]
39  new_args.append('.')
40  appcfg.main(new_args)
41
42
43class Command(BaseCommand):
44  """Calls the appcfg.py's rollback command for the current project.
45
46  Any additional arguments are passed directly to appcfg.py.
47  """
48  help = 'Calls appcfg.py rollback for the current project.'
49  args = '[any appcfg.py options]'
50
51  def run_from_argv(self, argv):
52    run_appcfg()