/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. import sys
  17. import logging
  18. from django.core.management.base import BaseCommand
  19. def run_appcfg():
  20. # import this so that we run through the checks at the beginning
  21. # and report the appropriate errors
  22. import appcfg
  23. # We don't really want to use that one though, it just executes this one
  24. from google.appengine.tools import appcfg
  25. # Reset the logging level to WARN as appcfg will spew tons of logs on INFO
  26. logging.getLogger().setLevel(logging.WARN)
  27. # Note: if we decide to change the name of this command to something other
  28. # than 'rollback' we will have to munge the args to replace whatever
  29. # we called it with 'rollback'
  30. new_args = sys.argv[:]
  31. new_args.append('.')
  32. appcfg.main(new_args)
  33. class Command(BaseCommand):
  34. """Calls the appcfg.py's rollback command for the current project.
  35. Any additional arguments are passed directly to appcfg.py.
  36. """
  37. help = 'Calls appcfg.py rollback for the current project.'
  38. args = '[any appcfg.py options]'
  39. def run_from_argv(self, argv):
  40. run_appcfg()