Skip to content

Commit 1459ec6

Browse files
committed
Merge pull request #1496 from rtfd/fix-imports
Move all imports to have "readthedocs" at the top level.
2 parents 4069bc3 + 7cbc3dd commit 1459ec6

File tree

125 files changed

+521
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+521
-510
lines changed

manage.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.sqlite")
7+
sys.path.append(os.getcwd())
8+
9+
from django.core.management import execute_from_command_line
10+
11+
execute_from_command_line(sys.argv)

readthedocs/api/base.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
from tastypie.http import HttpCreated, HttpApplicationError
1515
from tastypie.utils import dict_strip_unicode_keys, trailing_slash
1616

17-
from builds.constants import LATEST
18-
from builds.models import Build, Version
19-
from core.utils import trigger_build
20-
from projects.models import Project, ImportedFile
21-
from projects.version_handling import highest_version
22-
from projects.version_handling import parse_version_failsafe
17+
from readthedocs.builds.constants import LATEST
18+
from readthedocs.builds.models import Build, Version
19+
from readthedocs.core.utils import trigger_build
20+
from readthedocs.projects.models import Project, ImportedFile
21+
from readthedocs.projects.version_handling import highest_version
22+
from readthedocs.projects.version_handling import parse_version_failsafe
2323

2424
from .utils import SearchMixin, PostAuthentication
2525

@@ -30,7 +30,7 @@
3030

3131

3232
class ProjectResource(ModelResource, SearchMixin):
33-
users = fields.ToManyField('api.base.UserResource', 'users')
33+
users = fields.ToManyField('readthedocs.api.base.UserResource', 'users')
3434

3535
class Meta:
3636
include_absolute_url = True
@@ -209,8 +209,8 @@ def override_urls(self):
209209

210210

211211
class BuildResource(ModelResource):
212-
project = fields.ForeignKey('api.base.ProjectResource', 'project')
213-
version = fields.ForeignKey('api.base.VersionResource', 'version')
212+
project = fields.ForeignKey('readthedocs.api.base.ProjectResource', 'project')
213+
version = fields.ForeignKey('readthedocs.api.base.VersionResource', 'version')
214214

215215
class Meta:
216216
always_return_data = True

readthedocs/api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from tastypie import http
1414
from tastypie.utils.mime import build_content_type
1515

16-
from core.forms import FacetedSearchForm
16+
from readthedocs.core.forms import FacetedSearchForm
1717

1818
log = logging.getLogger(__name__)
1919

readthedocs/bookmarks/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33

44
from django.contrib import admin
5-
from bookmarks.models import Bookmark
5+
from readthedocs.bookmarks.models import Bookmark
66

77

88
class BookmarkAdmin(admin.ModelAdmin):

readthedocs/bookmarks/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from django.contrib.auth.models import User
33
from django.utils.translation import ugettext_lazy as _, ugettext
44

5-
from builds.models import Version
6-
from projects.models import Project
5+
from readthedocs.builds.models import Version
6+
from readthedocs.projects.models import Project
77

88

99
class Bookmark(models.Model):

readthedocs/bookmarks/urls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from django.conf.urls import patterns, url
2-
from bookmarks.views import BookmarkListView
3-
from bookmarks.views import BookmarkAddView, BookmarkRemoveView
4-
from bookmarks.views import BookmarkExistsView
2+
from readthedocs.bookmarks.views import BookmarkListView
3+
from readthedocs.bookmarks.views import BookmarkAddView, BookmarkRemoveView
4+
from readthedocs.bookmarks.views import BookmarkExistsView
55

66
urlpatterns = patterns(
77
# base view, flake8 complains if it is on the previous line.
8-
'bookmarks.views',
8+
'readthedocs.bookmarks.views',
99
url(r'^$',
1010
BookmarkListView.as_view(),
1111
name='bookmark_list'),

readthedocs/bookmarks/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from django.views.decorators.csrf import csrf_exempt
1111
import simplejson
1212

13-
from bookmarks.models import Bookmark
14-
from projects.models import Project
13+
from readthedocs.bookmarks.models import Bookmark
14+
from readthedocs.projects.models import Project
1515

1616
# These views are CSRF exempt because of Django's CSRF middleware failing here
1717
# https://github.com/django/django/blob/stable/1.6.x/django/middleware/csrf.py#L135-L159

readthedocs/builds/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
from django.contrib import admin
6-
from builds.models import Build, VersionAlias, Version
6+
from readthedocs.builds.models import Build, VersionAlias, Version
77
from guardian.admin import GuardedModelAdmin
88

99

readthedocs/builds/filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import django_filters
44

5-
from builds import constants
6-
from builds.models import Build, Version
5+
from readthedocs.builds import constants
6+
from readthedocs.builds.models import Build, Version
77

88

99
ANY_REPO = (

readthedocs/builds/forms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from django import forms
22

3-
from builds.models import VersionAlias, Version
4-
from projects.models import Project
5-
from core.utils import trigger_build
3+
from readthedocs.builds.models import VersionAlias, Version
4+
from readthedocs.projects.models import Project
5+
from readthedocs.core.utils import trigger_build
66

77

88
class AliasForm(forms.ModelForm):

readthedocs/builds/migrations/0001_initial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import unicode_literals
33

44
from django.db import models, migrations
5-
import builds.version_slug
5+
import readthedocs.builds.version_slug
66
import taggit.managers
77

88

@@ -44,7 +44,7 @@ class Migration(migrations.Migration):
4444
('type', models.CharField(default=b'unknown', max_length=20, verbose_name='Type', choices=[(b'branch', 'Branch'), (b'tag', 'Tag'), (b'unknown', 'Unknown')])),
4545
('identifier', models.CharField(max_length=255, verbose_name='Identifier')),
4646
('verbose_name', models.CharField(max_length=255, verbose_name='Verbose Name')),
47-
('slug', builds.version_slug.VersionSlugField(populate_from=b'verbose_name', max_length=255, verbose_name='Slug', db_index=True)),
47+
('slug', readthedocs.builds.version_slug.VersionSlugField(populate_from=b'verbose_name', max_length=255, verbose_name='Slug', db_index=True)),
4848
('supported', models.BooleanField(default=True, verbose_name='Supported')),
4949
('active', models.BooleanField(default=False, verbose_name='Active')),
5050
('built', models.BooleanField(default=False, verbose_name='Built')),

readthedocs/builds/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from guardian.shortcuts import assign
1212
from taggit.managers import TaggableManager
1313

14-
from privacy.loader import VersionManager, RelatedProjectManager
15-
from projects.models import Project
16-
from projects import constants
14+
from readthedocs.privacy.loader import VersionManager, RelatedProjectManager
15+
from readthedocs.projects.models import Project
16+
from readthedocs.projects import constants
1717
from .constants import (BUILD_STATE, BUILD_TYPES, VERSION_TYPES,
1818
LATEST, NON_REPOSITORY_VERSIONS, STABLE
1919
)

readthedocs/builds/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
urlpatterns = patterns(
77
# base view, flake8 complains if it is on the previous line.
8-
'builds.views',
8+
'readthedocs.builds.views',
99
url(r'^(?P<project_slug>[-\w]+)/(?P<pk>\d+)/$',
1010
BuildDetail.as_view(),
1111
name='builds_detail'),

readthedocs/builds/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from django.views.generic import ListView, DetailView
33
from django.conf import settings
44

5-
from builds.models import Build, Version
6-
from builds.filters import BuildFilter
7-
from projects.models import Project
5+
from readthedocs.builds.models import Build, Version
6+
from readthedocs.builds.filters import BuildFilter
7+
from readthedocs.projects.models import Project
88

99
from redis import Redis, ConnectionError
1010

readthedocs/comments/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sphinx.websupport.storage import StorageBackend
55

66
from .models import DocumentNode
7-
from comments.models import NodeSnapshot
7+
from readthedocs.comments.models import NodeSnapshot
88

99

1010
class DjangoStorage(StorageBackend):

readthedocs/comments/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from django.utils.translation import ugettext_lazy as _
44
from rest_framework import serializers
55

6-
from privacy.backend import AdminPermission, AdminNotAuthorized
7-
from restapi.serializers import VersionSerializer
6+
from readthedocs.privacy.backend import AdminPermission, AdminNotAuthorized
7+
from readthedocs.restapi.serializers import VersionSerializer
88

99

1010
class DocumentNodeManager(models.Manager):

readthedocs/comments/urls.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
# base view, flake8 complains if it is on the previous line.
55
'',
66
url(r'build',
7-
'comments.views.build',
7+
'readthedocs.comments.views.build',
88
name='build'),
99
url(r'_has_node',
10-
'comments.views.has_node',
10+
'readthedocs.comments.views.has_node',
1111
name='has_node'),
1212
url(r'_add_node',
13-
'comments.views.add_node',
13+
'readthedocs.comments.views.add_node',
1414
name='add_node'),
1515
url(r'_update_node',
16-
'comments.views.update_node',
16+
'readthedocs.comments.views.update_node',
1717
name='update_node'),
1818
url(r'_attach_comment',
19-
'comments.views.attach_comment',
19+
'readthedocs.comments.views.attach_comment',
2020
name='attach_comment'),
2121
url(r'_get_metadata',
22-
'comments.views.get_metadata',
22+
'readthedocs.comments.views.get_metadata',
2323
name='get_metadata'),
2424
url(r'_get_options',
25-
'comments.views.get_options',
25+
'readthedocs.comments.views.get_options',
2626
name='get_options'),
2727
url(r'(?P<file>.*)',
28-
'comments.views.serve_file',
28+
'readthedocs.comments.views.serve_file',
2929
name='serve_file'),
3030
)

readthedocs/comments/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
from rest_framework.viewsets import ModelViewSet
2222
from sphinx.websupport import WebSupport
2323

24-
from comments.models import DocumentComment, DocumentNode, NodeSnapshot, DocumentCommentSerializer,\
24+
from readthedocs.comments.models import DocumentComment, DocumentNode, NodeSnapshot, DocumentCommentSerializer,\
2525
DocumentNodeSerializer, ModerationActionSerializer
26-
from privacy.backend import AdminNotAuthorized
27-
from projects.models import Project
28-
from restapi.permissions import IsOwner, CommentModeratorOrReadOnly
26+
from readthedocs.privacy.backend import AdminNotAuthorized
27+
from readthedocs.projects.models import Project
28+
from readthedocs.restapi.permissions import IsOwner, CommentModeratorOrReadOnly
2929

3030
from .backend import DjangoStorage
3131
from .session import UnsafeSessionAuthentication

readthedocs/core/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from django.contrib import admin
55

6-
from core.models import UserProfile
6+
from readthedocs.core.models import UserProfile
77

88

99
class UserProfileAdmin(admin.ModelAdmin):

readthedocs/core/management/commands/build_files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from django.core.management.base import BaseCommand
55
from django.conf import settings
66

7-
from projects import tasks
8-
from builds.constants import LATEST
9-
from builds.models import Version
7+
from readthedocs.projects import tasks
8+
from readthedocs.builds.constants import LATEST
9+
from readthedocs.builds.models import Version
1010

1111
log = logging.getLogger(__name__)
1212

readthedocs/core/management/commands/clean_builds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.core.management.base import BaseCommand
66
from django.db.models import Max
77

8-
from builds.models import Build, Version
8+
from readthedocs.builds.models import Build, Version
99

1010
log = logging.getLogger(__name__)
1111

readthedocs/core/management/commands/import_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.core.management.base import BaseCommand
22
from django.contrib.auth.models import User
33

4-
from oauth.utils import import_github
4+
from readthedocs.oauth.utils import import_github
55

66

77
class Command(BaseCommand):

readthedocs/core/management/commands/import_intersphinx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from django.core.management.base import BaseCommand
22

3-
from builds.constants import LATEST
4-
from builds.models import Version
5-
from projects.tasks import update_intersphinx
3+
from readthedocs.builds.constants import LATEST
4+
from readthedocs.builds.models import Version
5+
from readthedocs.projects.tasks import update_intersphinx
66

77

88
class Command(BaseCommand):

readthedocs/core/management/commands/pull.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from django.core.management.base import BaseCommand
44
from django.conf import settings
55

6-
from builds.constants import LATEST
7-
from projects import tasks, utils
6+
from readthedocs.builds.constants import LATEST
7+
from readthedocs.projects import tasks, utils
88

99
import redis
1010

readthedocs/core/management/commands/reindex_elasticsearch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from django.core.management.base import BaseCommand
55
from django.conf import settings
66

7-
from builds.constants import LATEST
8-
from builds.models import Version
9-
from search import parse_json
10-
from restapi.utils import index_search_request
7+
from readthedocs.builds.constants import LATEST
8+
from readthedocs.builds.models import Version
9+
from readthedocs.search import parse_json
10+
from readthedocs.restapi.utils import index_search_request
1111

1212
log = logging.getLogger(__name__)
1313

readthedocs/core/management/commands/run_docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.core.management.base import BaseCommand
66

7-
from projects import tasks
7+
from readthedocs.projects import tasks
88

99
log = logging.getLogger(__name__)
1010

readthedocs/core/management/commands/set_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from django.core.management.base import BaseCommand
55
from django.conf import settings
66

7-
from projects import tasks
8-
from projects.models import Project
7+
from readthedocs.projects import tasks
8+
from readthedocs.projects.models import Project
99

1010
log = logging.getLogger(__name__)
1111

readthedocs/core/management/commands/symlink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.core.management.base import BaseCommand
44
from django.conf import settings
55

6-
from projects import tasks, utils
6+
from readthedocs.projects import tasks, utils
77

88
import redis
99

readthedocs/core/management/commands/sync_builds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from django.core.management.base import BaseCommand
44
from optparse import make_option
5-
from builds.models import Version
6-
from core.utils import copy_to_app_servers
5+
from readthedocs.builds.models import Version
6+
from readthedocs.core.utils import copy_to_app_servers
77

88
log = logging.getLogger(__name__)
99

readthedocs/core/management/commands/update_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from optparse import make_option
33

44
from django.core.management.base import BaseCommand
5-
from projects import tasks
6-
from api.client import api
5+
from readthedocs.projects import tasks
6+
from readthedocs.api.client import api
77

88

99
log = logging.getLogger(__name__)

0 commit comments

Comments
 (0)