PageRenderTime 22ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/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
15
16import os
17
18import django
19from django.core.management.commands import startapp
20
21import appengine_django
22
23
24class Command(startapp.Command):
25  def handle_label(self, *args, **kwds):
26    """Temporary adjust django.__path__ to load app templates from the
27    helpers directory.
28    """
29    old_path = django.__path__
30    django.__path__ = appengine_django.__path__
31    startapp.Command.handle_label(self, *args, **kwds)
32    django.__path__ = old_path
33
34
35class ProjectCommand(Command):
36  def __init__(self, project_directory):
37    super(ProjectCommand, self).__init__()
38    self.project_directory = project_directory
39
40  def handle_label(self, app_name, **options):
41    super(ProjectCommand, self).handle_label(app_name, self.project_directory,
42                                             **options)
43