/appengine_django/management/commands/startapp.py

http://google-app-engine-django.googlecode.com/ · Python · 43 lines · 17 code · 10 blank · 16 comment · 0 complexity · f7cdbe0271af53ba20afd54aaa985526 MD5 · raw file

  1. # Copyright 2008 Google Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. import django
  16. from django.core.management.commands import startapp
  17. import appengine_django
  18. class Command(startapp.Command):
  19. def handle_label(self, *args, **kwds):
  20. """Temporary adjust django.__path__ to load app templates from the
  21. helpers directory.
  22. """
  23. old_path = django.__path__
  24. django.__path__ = appengine_django.__path__
  25. startapp.Command.handle_label(self, *args, **kwds)
  26. django.__path__ = old_path
  27. class ProjectCommand(Command):
  28. def __init__(self, project_directory):
  29. super(ProjectCommand, self).__init__()
  30. self.project_directory = project_directory
  31. def handle_label(self, app_name, **options):
  32. super(ProjectCommand, self).handle_label(app_name, self.project_directory,
  33. **options)