Skip to content

Commit

Permalink
Merge pull request #1496 from rtfd/fix-imports
Browse files Browse the repository at this point in the history
Move all imports to have "readthedocs" at the top level.
  • Loading branch information
ericholscher committed Jul 30, 2015
2 parents 4069bc3 + 7cbc3dd commit 1459ec6
Show file tree
Hide file tree
Showing 125 changed files with 521 additions and 510 deletions.
11 changes: 11 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.sqlite")
sys.path.append(os.getcwd())

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
18 changes: 9 additions & 9 deletions readthedocs/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from tastypie.http import HttpCreated, HttpApplicationError
from tastypie.utils import dict_strip_unicode_keys, trailing_slash

from builds.constants import LATEST
from builds.models import Build, Version
from core.utils import trigger_build
from projects.models import Project, ImportedFile
from projects.version_handling import highest_version
from projects.version_handling import parse_version_failsafe
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Build, Version
from readthedocs.core.utils import trigger_build
from readthedocs.projects.models import Project, ImportedFile
from readthedocs.projects.version_handling import highest_version
from readthedocs.projects.version_handling import parse_version_failsafe

from .utils import SearchMixin, PostAuthentication

Expand All @@ -30,7 +30,7 @@


class ProjectResource(ModelResource, SearchMixin):
users = fields.ToManyField('api.base.UserResource', 'users')
users = fields.ToManyField('readthedocs.api.base.UserResource', 'users')

class Meta:
include_absolute_url = True
Expand Down Expand Up @@ -209,8 +209,8 @@ def override_urls(self):


class BuildResource(ModelResource):
project = fields.ForeignKey('api.base.ProjectResource', 'project')
version = fields.ForeignKey('api.base.VersionResource', 'version')
project = fields.ForeignKey('readthedocs.api.base.ProjectResource', 'project')
version = fields.ForeignKey('readthedocs.api.base.VersionResource', 'version')

class Meta:
always_return_data = True
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tastypie import http
from tastypie.utils.mime import build_content_type

from core.forms import FacetedSearchForm
from readthedocs.core.forms import FacetedSearchForm

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/bookmarks/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""

from django.contrib import admin
from bookmarks.models import Bookmark
from readthedocs.bookmarks.models import Bookmark


class BookmarkAdmin(admin.ModelAdmin):
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/bookmarks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _, ugettext

from builds.models import Version
from projects.models import Project
from readthedocs.builds.models import Version
from readthedocs.projects.models import Project


class Bookmark(models.Model):
Expand Down
8 changes: 4 additions & 4 deletions readthedocs/bookmarks/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django.conf.urls import patterns, url
from bookmarks.views import BookmarkListView
from bookmarks.views import BookmarkAddView, BookmarkRemoveView
from bookmarks.views import BookmarkExistsView
from readthedocs.bookmarks.views import BookmarkListView
from readthedocs.bookmarks.views import BookmarkAddView, BookmarkRemoveView
from readthedocs.bookmarks.views import BookmarkExistsView

urlpatterns = patterns(
# base view, flake8 complains if it is on the previous line.
'bookmarks.views',
'readthedocs.bookmarks.views',
url(r'^$',
BookmarkListView.as_view(),
name='bookmark_list'),
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/bookmarks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from django.views.decorators.csrf import csrf_exempt
import simplejson

from bookmarks.models import Bookmark
from projects.models import Project
from readthedocs.bookmarks.models import Bookmark
from readthedocs.projects.models import Project

# These views are CSRF exempt because of Django's CSRF middleware failing here
# https://github.com/django/django/blob/stable/1.6.x/django/middleware/csrf.py#L135-L159
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/builds/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from django.contrib import admin
from builds.models import Build, VersionAlias, Version
from readthedocs.builds.models import Build, VersionAlias, Version
from guardian.admin import GuardedModelAdmin


Expand Down
4 changes: 2 additions & 2 deletions readthedocs/builds/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import django_filters

from builds import constants
from builds.models import Build, Version
from readthedocs.builds import constants
from readthedocs.builds.models import Build, Version


ANY_REPO = (
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/builds/forms.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django import forms

from builds.models import VersionAlias, Version
from projects.models import Project
from core.utils import trigger_build
from readthedocs.builds.models import VersionAlias, Version
from readthedocs.projects.models import Project
from readthedocs.core.utils import trigger_build


class AliasForm(forms.ModelForm):
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/builds/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals

from django.db import models, migrations
import builds.version_slug
import readthedocs.builds.version_slug
import taggit.managers


Expand Down Expand Up @@ -44,7 +44,7 @@ class Migration(migrations.Migration):
('type', models.CharField(default=b'unknown', max_length=20, verbose_name='Type', choices=[(b'branch', 'Branch'), (b'tag', 'Tag'), (b'unknown', 'Unknown')])),
('identifier', models.CharField(max_length=255, verbose_name='Identifier')),
('verbose_name', models.CharField(max_length=255, verbose_name='Verbose Name')),
('slug', builds.version_slug.VersionSlugField(populate_from=b'verbose_name', max_length=255, verbose_name='Slug', db_index=True)),
('slug', readthedocs.builds.version_slug.VersionSlugField(populate_from=b'verbose_name', max_length=255, verbose_name='Slug', db_index=True)),
('supported', models.BooleanField(default=True, verbose_name='Supported')),
('active', models.BooleanField(default=False, verbose_name='Active')),
('built', models.BooleanField(default=False, verbose_name='Built')),
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from guardian.shortcuts import assign
from taggit.managers import TaggableManager

from privacy.loader import VersionManager, RelatedProjectManager
from projects.models import Project
from projects import constants
from readthedocs.privacy.loader import VersionManager, RelatedProjectManager
from readthedocs.projects.models import Project
from readthedocs.projects import constants
from .constants import (BUILD_STATE, BUILD_TYPES, VERSION_TYPES,
LATEST, NON_REPOSITORY_VERSIONS, STABLE
)
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/builds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

urlpatterns = patterns(
# base view, flake8 complains if it is on the previous line.
'builds.views',
'readthedocs.builds.views',
url(r'^(?P<project_slug>[-\w]+)/(?P<pk>\d+)/$',
BuildDetail.as_view(),
name='builds_detail'),
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/builds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from django.views.generic import ListView, DetailView
from django.conf import settings

from builds.models import Build, Version
from builds.filters import BuildFilter
from projects.models import Project
from readthedocs.builds.models import Build, Version
from readthedocs.builds.filters import BuildFilter
from readthedocs.projects.models import Project

from redis import Redis, ConnectionError

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/comments/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sphinx.websupport.storage import StorageBackend

from .models import DocumentNode
from comments.models import NodeSnapshot
from readthedocs.comments.models import NodeSnapshot


class DjangoStorage(StorageBackend):
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/comments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers

from privacy.backend import AdminPermission, AdminNotAuthorized
from restapi.serializers import VersionSerializer
from readthedocs.privacy.backend import AdminPermission, AdminNotAuthorized
from readthedocs.restapi.serializers import VersionSerializer


class DocumentNodeManager(models.Manager):
Expand Down
16 changes: 8 additions & 8 deletions readthedocs/comments/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
# base view, flake8 complains if it is on the previous line.
'',
url(r'build',
'comments.views.build',
'readthedocs.comments.views.build',
name='build'),
url(r'_has_node',
'comments.views.has_node',
'readthedocs.comments.views.has_node',
name='has_node'),
url(r'_add_node',
'comments.views.add_node',
'readthedocs.comments.views.add_node',
name='add_node'),
url(r'_update_node',
'comments.views.update_node',
'readthedocs.comments.views.update_node',
name='update_node'),
url(r'_attach_comment',
'comments.views.attach_comment',
'readthedocs.comments.views.attach_comment',
name='attach_comment'),
url(r'_get_metadata',
'comments.views.get_metadata',
'readthedocs.comments.views.get_metadata',
name='get_metadata'),
url(r'_get_options',
'comments.views.get_options',
'readthedocs.comments.views.get_options',
name='get_options'),
url(r'(?P<file>.*)',
'comments.views.serve_file',
'readthedocs.comments.views.serve_file',
name='serve_file'),
)
8 changes: 4 additions & 4 deletions readthedocs/comments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
from rest_framework.viewsets import ModelViewSet
from sphinx.websupport import WebSupport

from comments.models import DocumentComment, DocumentNode, NodeSnapshot, DocumentCommentSerializer,\
from readthedocs.comments.models import DocumentComment, DocumentNode, NodeSnapshot, DocumentCommentSerializer,\
DocumentNodeSerializer, ModerationActionSerializer
from privacy.backend import AdminNotAuthorized
from projects.models import Project
from restapi.permissions import IsOwner, CommentModeratorOrReadOnly
from readthedocs.privacy.backend import AdminNotAuthorized
from readthedocs.projects.models import Project
from readthedocs.restapi.permissions import IsOwner, CommentModeratorOrReadOnly

from .backend import DjangoStorage
from .session import UnsafeSessionAuthentication
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.contrib import admin

from core.models import UserProfile
from readthedocs.core.models import UserProfile


class UserProfileAdmin(admin.ModelAdmin):
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/core/management/commands/build_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from projects import tasks
from builds.constants import LATEST
from builds.models import Version
from readthedocs.projects import tasks
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/management/commands/clean_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.core.management.base import BaseCommand
from django.db.models import Max

from builds.models import Build, Version
from readthedocs.builds.models import Build, Version

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/management/commands/import_github.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User

from oauth.utils import import_github
from readthedocs.oauth.utils import import_github


class Command(BaseCommand):
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/core/management/commands/import_intersphinx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.core.management.base import BaseCommand

from builds.constants import LATEST
from builds.models import Version
from projects.tasks import update_intersphinx
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.tasks import update_intersphinx


class Command(BaseCommand):
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/management/commands/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from builds.constants import LATEST
from projects import tasks, utils
from readthedocs.builds.constants import LATEST
from readthedocs.projects import tasks, utils

import redis

Expand Down
8 changes: 4 additions & 4 deletions readthedocs/core/management/commands/reindex_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from builds.constants import LATEST
from builds.models import Version
from search import parse_json
from restapi.utils import index_search_request
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.search import parse_json
from readthedocs.restapi.utils import index_search_request

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/management/commands/run_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.core.management.base import BaseCommand

from projects import tasks
from readthedocs.projects import tasks

log = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/management/commands/set_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from projects import tasks
from projects.models import Project
from readthedocs.projects import tasks
from readthedocs.projects.models import Project

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/management/commands/symlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from projects import tasks, utils
from readthedocs.projects import tasks, utils

import redis

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/management/commands/sync_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.core.management.base import BaseCommand
from optparse import make_option
from builds.models import Version
from core.utils import copy_to_app_servers
from readthedocs.builds.models import Version
from readthedocs.core.utils import copy_to_app_servers

log = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/management/commands/update_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from optparse import make_option

from django.core.management.base import BaseCommand
from projects import tasks
from api.client import api
from readthedocs.projects import tasks
from readthedocs.api.client import api


log = logging.getLogger(__name__)
Expand Down
Loading

0 comments on commit 1459ec6

Please sign in to comment.