From daa7d4db3ca3d2eb114333683bfec2fc2fa7566a Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:12:10 -0700 Subject: [PATCH 01/12] Fix manage.py --- manage.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 manage.py diff --git a/manage.py b/manage.py new file mode 100755 index 00000000000..7fea7cb08ee --- /dev/null +++ b/manage.py @@ -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) From 87331068a3739e9fb7ba25450c894ed42689ee82 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:12:28 -0700 Subject: [PATCH 02/12] Add base settings --- readthedocs/settings/base.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py index f8044b3eaa0..099340f6d38 100644 --- a/readthedocs/settings/base.py +++ b/readthedocs/settings/base.py @@ -192,19 +192,19 @@ # our apps - 'bookmarks', - 'projects', - 'builds', - 'comments', - 'core', - 'doc_builder', - 'oauth', - 'redirects', - 'rtd_tests', - 'restapi', - 'privacy', - 'gold', - 'donate', + 'readthedocs.bookmarks', + 'readthedocs.projects', + 'readthedocs.builds', + 'readthedocs.comments', + 'readthedocs.core', + 'readthedocs.doc_builder', + 'readthedocs.oauth', + 'readthedocs.redirects', + 'readthedocs.rtd_tests', + 'readthedocs.restapi', + 'readthedocs.privacy', + 'readthedocs.gold', + 'readthedocs.donate', # allauth 'allauth', From ea1d07a0c64628df6bc27f7af896d9df1267baa6 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:13:11 -0700 Subject: [PATCH 03/12] Fix load path --- readthedocs/privacy/loader.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readthedocs/privacy/loader.py b/readthedocs/privacy/loader.py index 9ded65a3cc3..691bac6d9ff 100644 --- a/readthedocs/privacy/loader.py +++ b/readthedocs/privacy/loader.py @@ -2,12 +2,12 @@ from django.conf import settings # Managers -ProjectManager = import_by_path(getattr(settings, 'PROJECT_MANAGER', 'privacy.backend.ProjectManager')) -VersionManager = import_by_path(getattr(settings, 'VERSION_MANAGER', 'privacy.backend.VersionManager')) -RelatedProjectManager = import_by_path(getattr(settings, 'RELATED_PROJECT_MANAGER', 'privacy.backend.RelatedProjectManager')) +ProjectManager = import_by_path(getattr(settings, 'PROJECT_MANAGER', 'readthedocs.privacy.backend.ProjectManager')) +VersionManager = import_by_path(getattr(settings, 'VERSION_MANAGER', 'readthedocs.privacy.backend.VersionManager')) +RelatedProjectManager = import_by_path(getattr(settings, 'RELATED_PROJECT_MANAGER', 'readthedocs.privacy.backend.RelatedProjectManager')) # Permissions -AdminPermission = import_by_path(getattr(settings, 'ADMIN_PERMISSION', 'privacy.backend.AdminPermission')) +AdminPermission = import_by_path(getattr(settings, 'ADMIN_PERMISSION', 'readthedocs.privacy.backend.AdminPermission')) # Syncers -Syncer = import_by_path(getattr(settings, 'FILE_SYNCER', 'privacy.backends.syncers.LocalSyncer')) +Syncer = import_by_path(getattr(settings, 'FILE_SYNCER', 'readthedocs.privacy.backends.syncers.LocalSyncer')) From 3f69dfe058d7573babd0174e48b4a6e3a05f1e39 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:16:37 -0700 Subject: [PATCH 04/12] Fix one more privacy import --- readthedocs/settings/sqlite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/settings/sqlite.py b/readthedocs/settings/sqlite.py index 69f5389a3d2..5a250c550ff 100644 --- a/readthedocs/settings/sqlite.py +++ b/readthedocs/settings/sqlite.py @@ -43,7 +43,7 @@ CELERY_ALWAYS_EAGER = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -FILE_SYNCER = 'privacy.backends.syncers.LocalSyncer' +FILE_SYNCER = 'readthedocs.privacy.backends.syncers.LocalSyncer' # For testing locally. Put this in your /etc/hosts: # 127.0.0.1 test From 4b2ac53fe60de8c296018d139db349e6719bc50e Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:18:13 -0700 Subject: [PATCH 05/12] More base config --- readthedocs/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py index 099340f6d38..6de6d01a558 100644 --- a/readthedocs/settings/base.py +++ b/readthedocs/settings/base.py @@ -143,7 +143,7 @@ ) -ROOT_URLCONF = 'urls' +ROOT_URLCONF = 'readthedocs.urls' TEMPLATE_DIRS = ( '%s/readthedocs/templates/' % SITE_ROOT, From 2dde0c5beed0355538eabddb45dca22093a70f52 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:18:50 -0700 Subject: [PATCH 06/12] Fix loader backends --- readthedocs/doc_builder/loader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/doc_builder/loader.py b/readthedocs/doc_builder/loader.py index 53388f6bd85..29b8ab167da 100644 --- a/readthedocs/doc_builder/loader.py +++ b/readthedocs/doc_builder/loader.py @@ -2,8 +2,8 @@ from django.conf import settings # Managers -mkdocs = import_module(getattr(settings, 'MKDOCS_BACKEND', 'doc_builder.backends.mkdocs')) -sphinx = import_module(getattr(settings, 'SPHINX_BACKEND', 'doc_builder.backends.sphinx')) +mkdocs = import_module(getattr(settings, 'MKDOCS_BACKEND', 'readthedocs.doc_builder.backends.mkdocs')) +sphinx = import_module(getattr(settings, 'SPHINX_BACKEND', 'readthedocs.doc_builder.backends.sphinx')) BUILDER_BY_NAME = { # Possible HTML Builders From 047dd9df008f745c196f40af67abecfb63ba29f4 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:27:50 -0700 Subject: [PATCH 07/12] Fix 1-time migration issue --- readthedocs/builds/migrations/0001_initial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/builds/migrations/0001_initial.py b/readthedocs/builds/migrations/0001_initial.py index d9bdedcecf9..a4d1321e19e 100644 --- a/readthedocs/builds/migrations/0001_initial.py +++ b/readthedocs/builds/migrations/0001_initial.py @@ -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 @@ -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')), From eacbec210fea4723ee67e0168ded4098722262ce Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:29:12 -0700 Subject: [PATCH 08/12] Fix middleware --- readthedocs/settings/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py index 6de6d01a558..0a57eecc187 100644 --- a/readthedocs/settings/base.py +++ b/readthedocs/settings/base.py @@ -110,8 +110,8 @@ 'pagination.middleware.PaginationMiddleware', # Hack # 'core.underscore_middleware.UnderscoreMiddleware', - 'core.middleware.SubdomainMiddleware', - 'core.middleware.SingleVersionMiddleware', + 'readthedocs.core.middleware.SubdomainMiddleware', + 'readthedocs.core.middleware.SingleVersionMiddleware', 'corsheaders.middleware.CorsMiddleware', #'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ) @@ -157,7 +157,7 @@ "django.core.context_processors.media", "django.core.context_processors.request", # Read the Docs processor - "core.context_processors.readthedocs_processor", + "readthedocs.core.context_processors.readthedocs_processor", # allauth specific context processors "allauth.account.context_processors.account", "allauth.socialaccount.context_processors.socialaccount", @@ -398,7 +398,7 @@ 'level': 'DEBUG', 'propagate': False, }, - 'core.views.post_commit': { + 'readthedocs.core.views.post_commit': { 'handlers': ['postcommit'], 'level': 'DEBUG', 'propagate': False, @@ -418,7 +418,7 @@ 'level': 'ERROR', 'propagate': False, }, - 'projects.views.public.search': { + 'readthedocs.projects.views.public.search': { 'handlers': ['search'], 'level': 'DEBUG', 'propagate': False, From b286263ed34360bf3aaaae359261d3d3ef338d2a Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 16:50:58 -0700 Subject: [PATCH 09/12] Automated import refactoring --- readthedocs/api/base.py | 12 +-- readthedocs/api/utils.py | 2 +- readthedocs/bookmarks/admin.py | 2 +- readthedocs/bookmarks/models.py | 4 +- readthedocs/bookmarks/urls.py | 8 +- readthedocs/bookmarks/views.py | 4 +- readthedocs/builds/admin.py | 2 +- readthedocs/builds/filters.py | 4 +- readthedocs/builds/forms.py | 6 +- readthedocs/builds/models.py | 6 +- readthedocs/builds/urls.py | 2 +- readthedocs/builds/views.py | 6 +- readthedocs/comments/backend.py | 2 +- readthedocs/comments/models.py | 4 +- readthedocs/comments/urls.py | 16 ++-- readthedocs/comments/views.py | 8 +- readthedocs/core/admin.py | 2 +- .../core/management/commands/build_files.py | 6 +- .../core/management/commands/clean_builds.py | 2 +- .../core/management/commands/import_github.py | 2 +- .../management/commands/import_intersphinx.py | 6 +- readthedocs/core/management/commands/pull.py | 4 +- .../commands/reindex_elasticsearch.py | 8 +- .../core/management/commands/run_docker.py | 2 +- .../core/management/commands/set_metadata.py | 4 +- .../core/management/commands/symlink.py | 2 +- .../core/management/commands/sync_builds.py | 4 +- .../core/management/commands/update_api.py | 4 +- .../core/management/commands/update_docker.py | 4 +- .../core/management/commands/update_repos.py | 8 +- .../management/commands/update_versions.py | 4 +- readthedocs/core/middleware.py | 2 +- readthedocs/core/single_version_urls.py | 4 +- readthedocs/core/subdomain_urls.py | 24 +++--- readthedocs/core/templatetags/core_tags.py | 4 +- readthedocs/core/utils.py | 8 +- readthedocs/core/views.py | 22 ++--- readthedocs/doc_builder/backends/asciidoc.py | 4 +- readthedocs/doc_builder/backends/mkdocs.py | 4 +- readthedocs/doc_builder/backends/sphinx.py | 10 +-- readthedocs/doc_builder/environments.py | 4 +- readthedocs/donate/views.py | 2 +- readthedocs/gold/models.py | 2 +- readthedocs/gold/urls.py | 2 +- readthedocs/oauth/utils.py | 2 +- readthedocs/privacy/backend.py | 12 +-- .../privacy/templatetags/privacy_tags.py | 2 +- readthedocs/profiles/urls/private.py | 6 +- readthedocs/profiles/urls/public.py | 2 +- readthedocs/projects/admin.py | 6 +- readthedocs/projects/backends/views.py | 4 +- readthedocs/projects/feeds.py | 2 +- readthedocs/projects/filters.py | 4 +- readthedocs/projects/forms.py | 8 +- readthedocs/projects/models.py | 40 ++++----- readthedocs/projects/search_indexes.py | 4 +- readthedocs/projects/signals.py | 4 +- readthedocs/projects/symlinks.py | 6 +- readthedocs/projects/tasks.py | 40 ++++----- .../projects/templatetags/projects_tags.py | 2 +- readthedocs/projects/urls/private.py | 54 ++++++------ readthedocs/projects/urls/public.py | 24 +++--- readthedocs/projects/utils.py | 16 ++-- readthedocs/projects/version_handling.py | 4 +- readthedocs/projects/views/base.py | 2 +- readthedocs/projects/views/private.py | 26 +++--- readthedocs/projects/views/public.py | 12 +-- readthedocs/redirects/models.py | 2 +- readthedocs/restapi/permissions.py | 2 +- readthedocs/restapi/serializers.py | 4 +- readthedocs/restapi/urls.py | 18 ++-- readthedocs/restapi/utils.py | 6 +- readthedocs/restapi/views/core_views.py | 10 +-- readthedocs/restapi/views/footer_views.py | 6 +- readthedocs/restapi/views/model_views.py | 24 +++--- readthedocs/restapi/views/search_views.py | 10 +-- readthedocs/rtd_tests/base.py | 4 +- .../rtd_tests/factories/comments_factories.py | 6 +- .../rtd_tests/factories/projects_factories.py | 4 +- readthedocs/rtd_tests/tests/test_404.py | 2 +- readthedocs/rtd_tests/tests/test_backend.py | 6 +- readthedocs/rtd_tests/tests/test_bookmarks.py | 6 +- readthedocs/rtd_tests/tests/test_builds.py | 8 +- readthedocs/rtd_tests/tests/test_canonical.py | 2 +- readthedocs/rtd_tests/tests/test_celery.py | 10 +-- readthedocs/rtd_tests/tests/test_comments.py | 14 ++-- .../rtd_tests/tests/test_core_management.py | 6 +- readthedocs/rtd_tests/tests/test_core_tags.py | 8 +- .../rtd_tests/tests/test_doc_building.py | 10 +-- readthedocs/rtd_tests/tests/test_footer.py | 4 +- readthedocs/rtd_tests/tests/test_hacks.py | 2 +- .../rtd_tests/tests/test_middleware.py | 2 +- readthedocs/rtd_tests/tests/test_oauth.py | 6 +- .../rtd_tests/tests/test_post_commit_hooks.py | 4 +- readthedocs/rtd_tests/tests/test_privacy.py | 10 +-- readthedocs/rtd_tests/tests/test_project.py | 10 +-- .../rtd_tests/tests/test_project_symlinks.py | 6 +- .../rtd_tests/tests/test_project_views.py | 4 +- readthedocs/rtd_tests/tests/test_redirects.py | 6 +- .../rtd_tests/tests/test_redirects_utils.py | 4 +- .../rtd_tests/tests/test_repo_parsing.py | 2 +- .../tests/test_search_json_parsing.py | 2 +- .../rtd_tests/tests/test_single_version.py | 6 +- readthedocs/rtd_tests/tests/test_supported.py | 4 +- .../rtd_tests/tests/test_sync_versions.py | 6 +- readthedocs/rtd_tests/tests/test_urls.py | 4 +- .../rtd_tests/tests/test_version_slug.py | 8 +- .../rtd_tests/tests/test_version_windows.py | 2 +- readthedocs/rtd_tests/tests/test_views.py | 6 +- readthedocs/search/lib.py | 4 +- readthedocs/search/views.py | 12 +-- readthedocs/urls.py | 82 +++++++++---------- readthedocs/vcs_support/backends/bzr.py | 4 +- readthedocs/vcs_support/backends/git.py | 4 +- readthedocs/vcs_support/backends/hg.py | 4 +- readthedocs/vcs_support/backends/launchpad.py | 4 +- readthedocs/vcs_support/backends/svn.py | 4 +- readthedocs/vcs_support/test.py | 2 +- 118 files changed, 455 insertions(+), 455 deletions(-) diff --git a/readthedocs/api/base.py b/readthedocs/api/base.py index 0ff3e82e2be..099dfeeea05 100644 --- a/readthedocs/api/base.py +++ b/readthedocs/api/base.py @@ -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 diff --git a/readthedocs/api/utils.py b/readthedocs/api/utils.py index 6a3e04a0531..901938af120 100644 --- a/readthedocs/api/utils.py +++ b/readthedocs/api/utils.py @@ -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__) diff --git a/readthedocs/bookmarks/admin.py b/readthedocs/bookmarks/admin.py index 4d71bb0a052..3a5fb137cf3 100644 --- a/readthedocs/bookmarks/admin.py +++ b/readthedocs/bookmarks/admin.py @@ -2,7 +2,7 @@ """ from django.contrib import admin -from bookmarks.models import Bookmark +from readthedocs.bookmarks.models import Bookmark class BookmarkAdmin(admin.ModelAdmin): diff --git a/readthedocs/bookmarks/models.py b/readthedocs/bookmarks/models.py index 510d609db6c..333c5870142 100644 --- a/readthedocs/bookmarks/models.py +++ b/readthedocs/bookmarks/models.py @@ -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): diff --git a/readthedocs/bookmarks/urls.py b/readthedocs/bookmarks/urls.py index 278913ff6a7..a2d4288993f 100644 --- a/readthedocs/bookmarks/urls.py +++ b/readthedocs/bookmarks/urls.py @@ -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'), diff --git a/readthedocs/bookmarks/views.py b/readthedocs/bookmarks/views.py index 85c8b7f48be..ea86572062f 100644 --- a/readthedocs/bookmarks/views.py +++ b/readthedocs/bookmarks/views.py @@ -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 diff --git a/readthedocs/builds/admin.py b/readthedocs/builds/admin.py index cd094e73d30..41c828da4a8 100644 --- a/readthedocs/builds/admin.py +++ b/readthedocs/builds/admin.py @@ -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 diff --git a/readthedocs/builds/filters.py b/readthedocs/builds/filters.py index 1318aa92bd4..69c5ea4f43f 100644 --- a/readthedocs/builds/filters.py +++ b/readthedocs/builds/filters.py @@ -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 = ( diff --git a/readthedocs/builds/forms.py b/readthedocs/builds/forms.py index dc335613d97..ee1a58feaa5 100644 --- a/readthedocs/builds/forms.py +++ b/readthedocs/builds/forms.py @@ -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): diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index 6558a78948a..94cc4c85489 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -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 ) diff --git a/readthedocs/builds/urls.py b/readthedocs/builds/urls.py index 9bed4af91f0..bbd92d81304 100644 --- a/readthedocs/builds/urls.py +++ b/readthedocs/builds/urls.py @@ -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[-\w]+)/(?P\d+)/$', BuildDetail.as_view(), name='builds_detail'), diff --git a/readthedocs/builds/views.py b/readthedocs/builds/views.py index 73a6263742e..535960bd682 100644 --- a/readthedocs/builds/views.py +++ b/readthedocs/builds/views.py @@ -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 diff --git a/readthedocs/comments/backend.py b/readthedocs/comments/backend.py index cb41ff9cf9c..7a9c51c6d65 100644 --- a/readthedocs/comments/backend.py +++ b/readthedocs/comments/backend.py @@ -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): diff --git a/readthedocs/comments/models.py b/readthedocs/comments/models.py index 9df201e9944..f5d4331de3f 100644 --- a/readthedocs/comments/models.py +++ b/readthedocs/comments/models.py @@ -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): diff --git a/readthedocs/comments/urls.py b/readthedocs/comments/urls.py index 2474043adcc..65e256914f9 100644 --- a/readthedocs/comments/urls.py +++ b/readthedocs/comments/urls.py @@ -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.*)', - 'comments.views.serve_file', + 'readthedocs.comments.views.serve_file', name='serve_file'), ) diff --git a/readthedocs/comments/views.py b/readthedocs/comments/views.py index 81b7e439c91..05d2cd60994 100644 --- a/readthedocs/comments/views.py +++ b/readthedocs/comments/views.py @@ -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 diff --git a/readthedocs/core/admin.py b/readthedocs/core/admin.py index 2058bb1fea7..3560ddc79fb 100644 --- a/readthedocs/core/admin.py +++ b/readthedocs/core/admin.py @@ -3,7 +3,7 @@ from django.contrib import admin -from core.models import UserProfile +from readthedocs.core.models import UserProfile class UserProfileAdmin(admin.ModelAdmin): diff --git a/readthedocs/core/management/commands/build_files.py b/readthedocs/core/management/commands/build_files.py index 27c8d4d09eb..9759a3b6e03 100644 --- a/readthedocs/core/management/commands/build_files.py +++ b/readthedocs/core/management/commands/build_files.py @@ -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__) diff --git a/readthedocs/core/management/commands/clean_builds.py b/readthedocs/core/management/commands/clean_builds.py index 638b954b38f..90fb7be5a6f 100644 --- a/readthedocs/core/management/commands/clean_builds.py +++ b/readthedocs/core/management/commands/clean_builds.py @@ -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__) diff --git a/readthedocs/core/management/commands/import_github.py b/readthedocs/core/management/commands/import_github.py index f8287b9ad57..ef33965e301 100644 --- a/readthedocs/core/management/commands/import_github.py +++ b/readthedocs/core/management/commands/import_github.py @@ -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): diff --git a/readthedocs/core/management/commands/import_intersphinx.py b/readthedocs/core/management/commands/import_intersphinx.py index c16725db4c9..f89b79ae003 100644 --- a/readthedocs/core/management/commands/import_intersphinx.py +++ b/readthedocs/core/management/commands/import_intersphinx.py @@ -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): diff --git a/readthedocs/core/management/commands/pull.py b/readthedocs/core/management/commands/pull.py index 7f848b59595..40c5b437800 100644 --- a/readthedocs/core/management/commands/pull.py +++ b/readthedocs/core/management/commands/pull.py @@ -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 diff --git a/readthedocs/core/management/commands/reindex_elasticsearch.py b/readthedocs/core/management/commands/reindex_elasticsearch.py index f6f8b2337e7..435b059d072 100644 --- a/readthedocs/core/management/commands/reindex_elasticsearch.py +++ b/readthedocs/core/management/commands/reindex_elasticsearch.py @@ -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__) diff --git a/readthedocs/core/management/commands/run_docker.py b/readthedocs/core/management/commands/run_docker.py index f5a839765cc..8f407881198 100644 --- a/readthedocs/core/management/commands/run_docker.py +++ b/readthedocs/core/management/commands/run_docker.py @@ -4,7 +4,7 @@ from django.core.management.base import BaseCommand -from projects import tasks +from readthedocs.projects import tasks log = logging.getLogger(__name__) diff --git a/readthedocs/core/management/commands/set_metadata.py b/readthedocs/core/management/commands/set_metadata.py index 32ebb91cd03..3bd6f0e9033 100644 --- a/readthedocs/core/management/commands/set_metadata.py +++ b/readthedocs/core/management/commands/set_metadata.py @@ -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__) diff --git a/readthedocs/core/management/commands/symlink.py b/readthedocs/core/management/commands/symlink.py index 420a6eef302..c92ece37765 100644 --- a/readthedocs/core/management/commands/symlink.py +++ b/readthedocs/core/management/commands/symlink.py @@ -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 diff --git a/readthedocs/core/management/commands/sync_builds.py b/readthedocs/core/management/commands/sync_builds.py index ebde8b88ba8..251fa0f6de7 100644 --- a/readthedocs/core/management/commands/sync_builds.py +++ b/readthedocs/core/management/commands/sync_builds.py @@ -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__) diff --git a/readthedocs/core/management/commands/update_api.py b/readthedocs/core/management/commands/update_api.py index 1854ac06d95..88c482e426c 100644 --- a/readthedocs/core/management/commands/update_api.py +++ b/readthedocs/core/management/commands/update_api.py @@ -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__) diff --git a/readthedocs/core/management/commands/update_docker.py b/readthedocs/core/management/commands/update_docker.py index c1d75d05c33..5440fa1c712 100644 --- a/readthedocs/core/management/commands/update_docker.py +++ b/readthedocs/core/management/commands/update_docker.py @@ -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__) diff --git a/readthedocs/core/management/commands/update_repos.py b/readthedocs/core/management/commands/update_repos.py index 9797de16dc1..17aa5164d3b 100644 --- a/readthedocs/core/management/commands/update_repos.py +++ b/readthedocs/core/management/commands/update_repos.py @@ -2,10 +2,10 @@ from optparse import make_option from django.core.management.base import BaseCommand -from projects import tasks -from projects.models import Project -from builds.models import Version -from core.utils import trigger_build +from readthedocs.projects import tasks +from readthedocs.projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.core.utils import trigger_build log = logging.getLogger(__name__) diff --git a/readthedocs/core/management/commands/update_versions.py b/readthedocs/core/management/commands/update_versions.py index f0d6c770e42..d4a580b3059 100644 --- a/readthedocs/core/management/commands/update_versions.py +++ b/readthedocs/core/management/commands/update_versions.py @@ -1,6 +1,6 @@ -from builds.models import Version +from readthedocs.builds.models import Version from django.core.management.base import BaseCommand -from projects.tasks import update_docs +from readthedocs.projects.tasks import update_docs class Command(BaseCommand): diff --git a/readthedocs/core/middleware.py b/readthedocs/core/middleware.py index d7b4b23e2e5..c93b50c40e8 100644 --- a/readthedocs/core/middleware.py +++ b/readthedocs/core/middleware.py @@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.http import Http404 -from projects.models import Project +from readthedocs.projects.models import Project import redis diff --git a/readthedocs/core/single_version_urls.py b/readthedocs/core/single_version_urls.py index 4d41032893b..857d455034b 100644 --- a/readthedocs/core/single_version_urls.py +++ b/readthedocs/core/single_version_urls.py @@ -4,11 +4,11 @@ '', # base view, flake8 complains if it is on the previous line. # Handle /docs on RTD domain url(r'^docs/(?P[-\w]+)/(?P.*)$', - 'core.views.serve_single_version_docs', + 'readthedocs.core.views.serve_single_version_docs', name='docs_detail'), # Handle subdomains url(r'^(?P.*)$', - 'core.views.serve_single_version_docs', + 'readthedocs.core.views.serve_single_version_docs', name='docs_detail'), ) diff --git a/readthedocs/core/subdomain_urls.py b/readthedocs/core/subdomain_urls.py index 9409385dc89..8912bd7c40a 100644 --- a/readthedocs/core/subdomain_urls.py +++ b/readthedocs/core/subdomain_urls.py @@ -1,48 +1,48 @@ from django.conf.urls import url, patterns -from projects.constants import LANGUAGES_REGEX +from readthedocs.projects.constants import LANGUAGES_REGEX from urls import urlpatterns as main_patterns -handler500 = 'core.views.server_error' -handler404 = 'core.views.server_error_404' +handler500 = 'readthedocs.core.views.server_error' +handler404 = 'readthedocs.core.views.server_error_404' urlpatterns = patterns( '', # base view, flake8 complains if it is on the previous line. url((r'^projects/(?P[\w.-]+)/(?P%s)/' r'(?P[\w.-]+)/(?P.*)$' % LANGUAGES_REGEX), - 'core.views.subproject_serve_docs', + 'readthedocs.core.views.subproject_serve_docs', name='subproject_docs_detail'), url(r'^projects/(?P[\w.-]+)', - 'core.views.subproject_serve_docs', + 'readthedocs.core.views.subproject_serve_docs', name='subproject_docs_detail'), url(r'^projects/$', - 'core.views.subproject_list', + 'readthedocs.core.views.subproject_list', name='subproject_docs_list'), url(r'^(?P%s)/(?P[\w.-]+)/(?P.*)$' % LANGUAGES_REGEX, - 'core.views.serve_docs', + 'readthedocs.core.views.serve_docs', name='docs_detail'), url(r'^(?P%s)/(?P.*)/$' % LANGUAGES_REGEX, - 'core.views.serve_docs', + 'readthedocs.core.views.serve_docs', {'filename': 'index.html'}, name='docs_detail'), url(r'^page/(?P.*)$', - 'core.views.redirect_page_with_filename', + 'readthedocs.core.views.redirect_page_with_filename', name='docs_detail'), url(r'^(?P%s)/$' % LANGUAGES_REGEX, - 'core.views.redirect_lang_slug', + 'readthedocs.core.views.redirect_lang_slug', name='lang_subdomain_handler'), url(r'^(?P.*)/$', - 'core.views.redirect_version_slug', + 'readthedocs.core.views.redirect_version_slug', name='version_subdomain_handler'), - url(r'^$', 'core.views.redirect_project_slug', name='homepage'), + url(r'^$', 'readthedocs.core.views.redirect_project_slug', name='homepage'), ) urlpatterns += main_patterns diff --git a/readthedocs/core/templatetags/core_tags.py b/readthedocs/core/templatetags/core_tags.py index 8b2820394e0..94b5359493b 100644 --- a/readthedocs/core/templatetags/core_tags.py +++ b/readthedocs/core/templatetags/core_tags.py @@ -6,8 +6,8 @@ from django.utils.safestring import mark_safe from django.utils.encoding import force_bytes, force_text -from builds.models import Version -from projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project register = template.Library() diff --git a/readthedocs/core/utils.py b/readthedocs/core/utils.py index 8947e6048ae..794d0d4de80 100644 --- a/readthedocs/core/utils.py +++ b/readthedocs/core/utils.py @@ -9,9 +9,9 @@ from django.template.loader import get_template from django.template import Context -from builds.constants import LATEST -from builds.constants import LATEST_VERBOSE_NAME -from builds.models import Build +from readthedocs.builds.constants import LATEST +from readthedocs.builds.constants import LATEST_VERBOSE_NAME +from readthedocs.builds.models import Build log = logging.getLogger(__name__) @@ -59,7 +59,7 @@ def trigger_build(project, version=None, record=True, force=False, basic=False): An API to wrap the triggering of a build. """ # Avoid circular import - from projects.tasks import update_docs + from readthedocs.projects.tasks import update_docs if project.skip: return None diff --git a/readthedocs/core/views.py b/readthedocs/core/views.py index 535c2b9d62e..c6adad76949 100644 --- a/readthedocs/core/views.py +++ b/readthedocs/core/views.py @@ -19,17 +19,17 @@ from celery.task.control import inspect import stripe -from builds.models import Build -from builds.models import Version -from core.forms import FacetedSearchForm -from core.utils import trigger_build -from donate.mixins import DonateProgressMixin -from builds.constants import LATEST -from projects import constants -from projects.models import Project, ImportedFile, ProjectRelationship -from projects.tasks import remove_dir, update_imported_docs -from redirects.models import Redirect -from redirects.utils import redirect_filename +from readthedocs.builds.models import Build +from readthedocs.builds.models import Version +from readthedocs.core.forms import FacetedSearchForm +from readthedocs.core.utils import trigger_build +from readthedocs.donate.mixins import DonateProgressMixin +from readthedocs.builds.constants import LATEST +from readthedocs.projects import constants +from readthedocs.projects.models import Project, ImportedFile, ProjectRelationship +from readthedocs.projects.tasks import remove_dir, update_imported_docs +from readthedocs.redirects.models import Redirect +from readthedocs.redirects.utils import redirect_filename import json import mimetypes diff --git a/readthedocs/doc_builder/backends/asciidoc.py b/readthedocs/doc_builder/backends/asciidoc.py index d55b3619dd6..eac8de3e37c 100644 --- a/readthedocs/doc_builder/backends/asciidoc.py +++ b/readthedocs/doc_builder/backends/asciidoc.py @@ -1,8 +1,8 @@ import os import logging -from doc_builder.base import BaseBuilder, restoring_chdir -from projects.utils import run +from readthedocs.doc_builder.base import BaseBuilder, restoring_chdir +from readthedocs.projects.utils import run log = logging.getLogger(__name__) diff --git a/readthedocs/doc_builder/backends/mkdocs.py b/readthedocs/doc_builder/backends/mkdocs.py index ff796e4d99d..97cb2701411 100644 --- a/readthedocs/doc_builder/backends/mkdocs.py +++ b/readthedocs/doc_builder/backends/mkdocs.py @@ -6,8 +6,8 @@ from django.conf import settings from django.template import Context, loader as template_loader -from doc_builder.base import BaseBuilder, restoring_chdir -from projects.utils import run +from readthedocs.doc_builder.base import BaseBuilder, restoring_chdir +from readthedocs.projects.utils import run log = logging.getLogger(__name__) diff --git a/readthedocs/doc_builder/backends/sphinx.py b/readthedocs/doc_builder/backends/sphinx.py index 4e97c2fded1..549274bd1dc 100644 --- a/readthedocs/doc_builder/backends/sphinx.py +++ b/readthedocs/doc_builder/backends/sphinx.py @@ -10,11 +10,11 @@ from django.template.loader import render_to_string from django.conf import settings -from builds import utils as version_utils -from doc_builder.base import BaseBuilder, restoring_chdir -from projects.utils import run, safe_write -from projects.exceptions import ProjectImportError -from restapi.client import api +from readthedocs.builds import utils as version_utils +from readthedocs.doc_builder.base import BaseBuilder, restoring_chdir +from readthedocs.projects.utils import run, safe_write +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.restapi.client import api log = logging.getLogger(__name__) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 18d4822a5e8..fb27eca67b3 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -12,8 +12,8 @@ from django.conf import settings from rest_framework.renderers import JSONRenderer -from projects.utils import run -from restapi.serializers import VersionFullSerializer +from readthedocs.projects.utils import run +from readthedocs.restapi.serializers import VersionFullSerializer log = logging.getLogger(__name__) diff --git a/readthedocs/donate/views.py b/readthedocs/donate/views.py index 536e321a472..f183314c2c5 100644 --- a/readthedocs/donate/views.py +++ b/readthedocs/donate/views.py @@ -10,7 +10,7 @@ from django.contrib.messages.views import SuccessMessageMixin from django.utils.translation import ugettext_lazy as _ -from core.mixins import StripeMixin +from readthedocs.core.mixins import StripeMixin from .models import Supporter from .forms import SupporterForm from .mixins import DonateProgressMixin diff --git a/readthedocs/gold/models.py b/readthedocs/gold/models.py index bf1909702ef..7208ab65f22 100644 --- a/readthedocs/gold/models.py +++ b/readthedocs/gold/models.py @@ -1,7 +1,7 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ -from projects.models import Project +from readthedocs.projects.models import Project LEVEL_CHOICES = ( ('v1-org-5', '$5/mo'), diff --git a/readthedocs/gold/urls.py b/readthedocs/gold/urls.py index b583ad96568..c99ca96bc85 100644 --- a/readthedocs/gold/urls.py +++ b/readthedocs/gold/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url, patterns, include -from gold import views +from readthedocs.gold import views urlpatterns = patterns('', diff --git a/readthedocs/oauth/utils.py b/readthedocs/oauth/utils.py index 4b692d8e5c9..3cc4bcc09c3 100644 --- a/readthedocs/oauth/utils.py +++ b/readthedocs/oauth/utils.py @@ -6,7 +6,7 @@ from requests_oauthlib import OAuth1Session, OAuth2Session from .models import GithubProject, GithubOrganization, BitbucketProject, BitbucketTeam -from restapi.client import api +from readthedocs.restapi.client import api log = logging.getLogger(__name__) diff --git a/readthedocs/privacy/backend.py b/readthedocs/privacy/backend.py index 4a7e5964ae3..be23162d6e8 100644 --- a/readthedocs/privacy/backend.py +++ b/readthedocs/privacy/backend.py @@ -3,18 +3,18 @@ from guardian.shortcuts import get_objects_for_user -from builds.constants import LATEST -from builds.constants import LATEST_VERBOSE_NAME -from builds.constants import STABLE -from builds.constants import STABLE_VERBOSE_NAME -from projects import constants +from readthedocs.builds.constants import LATEST +from readthedocs.builds.constants import LATEST_VERBOSE_NAME +from readthedocs.builds.constants import STABLE +from readthedocs.builds.constants import STABLE_VERBOSE_NAME +from readthedocs.projects import constants class ProjectManager(models.Manager): def _add_user_repos(self, queryset, user): # Avoid circular import - from projects.models import Project + from readthedocs.projects.models import Project # Show all projects to super user if user.has_perm('projects.view_project'): return Project.objects.all().distinct() diff --git a/readthedocs/privacy/templatetags/privacy_tags.py b/readthedocs/privacy/templatetags/privacy_tags.py index c4825835bd3..6edebd8e108 100644 --- a/readthedocs/privacy/templatetags/privacy_tags.py +++ b/readthedocs/privacy/templatetags/privacy_tags.py @@ -2,7 +2,7 @@ from ..loader import AdminPermission -from projects.models import Project +from readthedocs.projects.models import Project register = template.Library() diff --git a/readthedocs/profiles/urls/private.py b/readthedocs/profiles/urls/private.py index 4af44f26aca..bd948085a7e 100644 --- a/readthedocs/profiles/urls/private.py +++ b/readthedocs/profiles/urls/private.py @@ -1,14 +1,14 @@ from django.conf.urls import * -from core.forms import UserProfileForm +from readthedocs.core.forms import UserProfileForm urlpatterns = patterns('', - url(r'^create/', 'profiles.views.create_profile', + url(r'^create/', 'readthedocs.profiles.views.create_profile', { 'form_class': UserProfileForm, }, name='profiles_profile_create'), - url(r'^edit/', 'profiles.views.edit_profile', + url(r'^edit/', 'readthedocs.profiles.views.edit_profile', { 'form_class': UserProfileForm, 'template_name': 'profiles/private/edit_profile.html', diff --git a/readthedocs/profiles/urls/public.py b/readthedocs/profiles/urls/public.py index fac2a31260f..d1b58cfc71f 100644 --- a/readthedocs/profiles/urls/public.py +++ b/readthedocs/profiles/urls/public.py @@ -1,6 +1,6 @@ from django.conf.urls import * -from profiles import views +from readthedocs.profiles import views urlpatterns = patterns('', diff --git a/readthedocs/projects/admin.py b/readthedocs/projects/admin.py index cb56e54614d..6f96b0e4d7a 100644 --- a/readthedocs/projects/admin.py +++ b/readthedocs/projects/admin.py @@ -2,10 +2,10 @@ and related models. """ -from builds.models import Version +from readthedocs.builds.models import Version from django.contrib import admin -from redirects.models import Redirect -from projects.models import (Project, ImportedFile, ProjectRelationship, EmailHook, WebHook) +from readthedocs.redirects.models import Redirect +from readthedocs.projects.models import (Project, ImportedFile, ProjectRelationship, EmailHook, WebHook) from guardian.admin import GuardedModelAdmin diff --git a/readthedocs/projects/backends/views.py b/readthedocs/projects/backends/views.py index b5f26d2a455..f8aaa9c3d3d 100644 --- a/readthedocs/projects/backends/views.py +++ b/readthedocs/projects/backends/views.py @@ -13,12 +13,12 @@ ImportWizardView = import_by_path(getattr( settings, 'PROJECT_IMPORT_VIEW', - 'projects.views.private.ImportWizardView' + 'readthedocs.projects.views.private.ImportWizardView' )) # Project demo import ImportDemoView = import_by_path(getattr( settings, 'PROJECT_IMPORT_DEMO_VIEW', - 'projects.views.private.ImportDemoView' + 'readthedocs.projects.views.private.ImportDemoView' )) diff --git a/readthedocs/projects/feeds.py b/readthedocs/projects/feeds.py index 13eb08f9807..727fcf9d835 100644 --- a/readthedocs/projects/feeds.py +++ b/readthedocs/projects/feeds.py @@ -1,6 +1,6 @@ from django.contrib.syndication.views import Feed -from projects.models import Project +from readthedocs.projects.models import Project class LatestProjectsFeed(Feed): diff --git a/readthedocs/projects/filters.py b/readthedocs/projects/filters.py index d52ed2febac..9257203d2c4 100644 --- a/readthedocs/projects/filters.py +++ b/readthedocs/projects/filters.py @@ -2,8 +2,8 @@ import django_filters -from projects import constants -from projects.models import Project +from readthedocs.projects import constants +from readthedocs.projects.models import Project ANY_REPO = ( ('', _('Any')), diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py index 564426a25ea..c242216b43c 100644 --- a/readthedocs/projects/forms.py +++ b/readthedocs/projects/forms.py @@ -10,10 +10,10 @@ from guardian.shortcuts import assign -from core.utils import trigger_build -from redirects.models import Redirect -from projects import constants -from projects.models import Project, EmailHook, WebHook +from readthedocs.core.utils import trigger_build +from readthedocs.redirects.models import Redirect +from readthedocs.projects import constants +from readthedocs.projects.models import Project, EmailHook, WebHook class ProjectForm(forms.ModelForm): diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index 05c23f5ff9d..1491ce2bfc2 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -12,23 +12,23 @@ from guardian.shortcuts import assign -from builds.constants import LATEST -from builds.constants import LATEST_VERBOSE_NAME -from builds.constants import STABLE -from oauth import utils as oauth_utils -from privacy.loader import RelatedProjectManager, ProjectManager -from projects import constants -from projects.exceptions import ProjectImportError -from projects.templatetags.projects_tags import sort_version_aware -from projects.utils import make_api_version, symlink, update_static_metadata -from projects.version_handling import determine_stable_version -from projects.version_handling import version_windows +from readthedocs.builds.constants import LATEST +from readthedocs.builds.constants import LATEST_VERBOSE_NAME +from readthedocs.builds.constants import STABLE +from readthedocs.oauth import utils as oauth_utils +from readthedocs.privacy.loader import RelatedProjectManager, ProjectManager +from readthedocs.projects import constants +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.projects.templatetags.projects_tags import sort_version_aware +from readthedocs.projects.utils import make_api_version, symlink, update_static_metadata +from readthedocs.projects.version_handling import determine_stable_version +from readthedocs.projects.version_handling import version_windows from taggit.managers import TaggableManager -from api.client import api +from readthedocs.api.client import api -from vcs_support.base import VCSProject -from vcs_support.backends import backend_cls -from vcs_support.utils import Lock, NonBlockingLock +from readthedocs.vcs_support.base import VCSProject +from readthedocs.vcs_support.backends import backend_cls +from readthedocs.vcs_support.utils import Lock, NonBlockingLock log = logging.getLogger(__name__) @@ -680,13 +680,13 @@ def api_versions(self): return sort_version_aware(ret) def active_versions(self): - from builds.models import Version + from readthedocs.builds.models import Version versions = Version.objects.public(project=self, only_active=True) return (versions.filter(built=True, active=True) | versions.filter(active=True, uploaded=True)) def ordered_active_versions(self): - from builds.models import Version + from readthedocs.builds.models import Version versions = Version.objects.public(project=self, only_active=True) return sort_version_aware(versions) @@ -799,7 +799,7 @@ def remove_subproject(self, child): def moderation_queue(self): # non-optimal SQL warning. - from comments.models import DocumentComment + from readthedocs.comments.models import DocumentComment queue = [] comments = DocumentComment.objects.filter(node__project=self) for comment in comments: @@ -809,7 +809,7 @@ def moderation_queue(self): return queue def add_node(self, node_hash, page, version, commit): - from comments.models import NodeSnapshot, DocumentNode + from readthedocs.comments.models import NodeSnapshot, DocumentNode project_obj = Project.objects.get(slug=self.slug) version_obj = project_obj.versions.get(slug=version) try: @@ -826,7 +826,7 @@ def add_node(self, node_hash, page, version, commit): return True # ie, it's True that a new node was created. def add_comment(self, version_slug, page, hash, commit, user, text): - from comments.models import DocumentNode + from readthedocs.comments.models import DocumentNode try: node = self.nodes.from_hash(version_slug, page, hash) except DocumentNode.DoesNotExist: diff --git a/readthedocs/projects/search_indexes.py b/readthedocs/projects/search_indexes.py index 073572dd203..a6fb7e663d2 100644 --- a/readthedocs/projects/search_indexes.py +++ b/readthedocs/projects/search_indexes.py @@ -10,8 +10,8 @@ from haystack import indexes from haystack.fields import CharField -from projects import constants -from projects.models import ImportedFile, Project +from readthedocs.projects import constants +from readthedocs.projects.models import ImportedFile, Project import logging log = logging.getLogger(__name__) diff --git a/readthedocs/projects/signals.py b/readthedocs/projects/signals.py index d93b0cbf46a..d2a6602aa24 100644 --- a/readthedocs/projects/signals.py +++ b/readthedocs/projects/signals.py @@ -7,8 +7,8 @@ from django.dispatch import receiver from django.utils.translation import ugettext_lazy as _ -from builds import utils as build_utils -from oauth import utils as oauth_utils +from readthedocs.builds import utils as build_utils +from readthedocs.oauth import utils as oauth_utils before_vcs = django.dispatch.Signal(providing_args=["version"]) after_vcs = django.dispatch.Signal(providing_args=["version"]) diff --git a/readthedocs/projects/symlinks.py b/readthedocs/projects/symlinks.py index 78d2c982aad..90393cbda51 100644 --- a/readthedocs/projects/symlinks.py +++ b/readthedocs/projects/symlinks.py @@ -4,9 +4,9 @@ from django.conf import settings import redis -from core.utils import run_on_app_servers -from projects.constants import LOG_TEMPLATE -from restapi.client import api +from readthedocs.core.utils import run_on_app_servers +from readthedocs.projects.constants import LOG_TEMPLATE +from readthedocs.restapi.client import api log = logging.getLogger(__name__) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 08ce271ef83..065fa6e4a8f 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -16,30 +16,30 @@ from django.utils.translation import ugettext_lazy as _ from slumber.exceptions import HttpClientError -from builds.constants import LATEST -from builds.models import Build, Version -from core.utils import send_email, run_on_app_servers -from doc_builder.loader import get_builder_class -from doc_builder.base import restoring_chdir -from doc_builder.environments import DockerEnvironment -from projects.exceptions import ProjectImportError -from projects.models import ImportedFile, Project -from projects.utils import run, make_api_version, make_api_project -from projects.constants import LOG_TEMPLATE -from builds.constants import STABLE -from projects import symlinks -from privacy.loader import Syncer -from search.parse_json import process_all_json_files -from search.utils import process_mkdocs_json -from restapi.utils import index_search_request -from vcs_support import utils as vcs_support_utils -from api.client import api as api_v1 -from restapi.client import api as api_v2 +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Build, Version +from readthedocs.core.utils import send_email, run_on_app_servers +from readthedocs.doc_builder.loader import get_builder_class +from readthedocs.doc_builder.base import restoring_chdir +from readthedocs.doc_builder.environments import DockerEnvironment +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.projects.models import ImportedFile, Project +from readthedocs.projects.utils import run, make_api_version, make_api_project +from readthedocs.projects.constants import LOG_TEMPLATE +from readthedocs.builds.constants import STABLE +from readthedocs.projects import symlinks +from readthedocs.privacy.loader import Syncer +from readthedocs.search.parse_json import process_all_json_files +from readthedocs.search.utils import process_mkdocs_json +from readthedocs.restapi.utils import index_search_request +from readthedocs.vcs_support import utils as vcs_support_utils +from readthedocs.api.client import api as api_v1 +from readthedocs.restapi.client import api as api_v2 try: from readthedocs.projects.signals import before_vcs, after_vcs, before_build, after_build except: - from projects.signals import before_vcs, after_vcs, before_build, after_build + from readthedocs.projects.signals import before_vcs, after_vcs, before_build, after_build log = logging.getLogger(__name__) diff --git a/readthedocs/projects/templatetags/projects_tags.py b/readthedocs/projects/templatetags/projects_tags.py index 779a51d5cfa..b5eaf19e2b7 100644 --- a/readthedocs/projects/templatetags/projects_tags.py +++ b/readthedocs/projects/templatetags/projects_tags.py @@ -1,6 +1,6 @@ from django import template -from projects.version_handling import comparable_version +from readthedocs.projects.version_handling import comparable_version register = template.Library() diff --git a/readthedocs/projects/urls/private.py b/readthedocs/projects/urls/private.py index 6e0e5c10869..0f986710fbe 100644 --- a/readthedocs/projects/urls/private.py +++ b/readthedocs/projects/urls/private.py @@ -1,7 +1,7 @@ from django.conf.urls import patterns, url -from projects.views.private import AliasList, ProjectDashboard, ImportView -from projects.backends.views import ImportWizardView, ImportDemoView +from readthedocs.projects.views.private import AliasList, ProjectDashboard, ImportView +from readthedocs.projects.backends.views import ImportWizardView, ImportDemoView urlpatterns = patterns( @@ -25,35 +25,35 @@ name='projects_import_demo'), url(r'^import/github/$', - 'projects.views.private.project_import_github', + 'readthedocs.projects.views.private.project_import_github', {'sync': False}, name='projects_import_github'), url(r'^import/github/sync/$', - 'projects.views.private.project_import_github', + 'readthedocs.projects.views.private.project_import_github', {'sync': True}, name='projects_sync_github'), url(r'^import/bitbucket/$', - 'projects.views.private.project_import_bitbucket', + 'readthedocs.projects.views.private.project_import_bitbucket', {'sync': False}, name='projects_import_bitbucket'), url(r'^import/bitbucket/sync/$', - 'projects.views.private.project_import_bitbucket', + 'readthedocs.projects.views.private.project_import_bitbucket', {'sync': True}, name='projects_sync_bitbucket'), url(r'^(?P[-\w]+)/$', - 'projects.views.private.project_manage', + 'readthedocs.projects.views.private.project_manage', name='projects_manage'), url(r'^(?P[-\w]+)/alias/(?P\d+)/', - 'projects.views.private.edit_alias', + 'readthedocs.projects.views.private.edit_alias', name='projects_alias_edit'), url(r'^(?P[-\w]+)/alias/$', - 'projects.views.private.edit_alias', + 'readthedocs.projects.views.private.edit_alias', name='projects_alias_create'), url(r'^(?P[-\w]+)/alias/list/$', @@ -61,74 +61,74 @@ name='projects_alias_list'), url(r'^(?P[-\w]+)/comments_moderation/$', - 'projects.views.private.project_comments_moderation', + 'readthedocs.projects.views.private.project_comments_moderation', name='projects_comments_moderation'), url(r'^(?P[-\w]+)/edit/$', - 'projects.views.private.project_edit', + 'readthedocs.projects.views.private.project_edit', name='projects_edit'), url(r'^(?P[-\w]+)/advanced/$', - 'projects.views.private.project_advanced', + 'readthedocs.projects.views.private.project_advanced', name='projects_advanced'), url(r'^(?P[-\w]+)/version/(?P[^/]+)/delete_html/$', - 'projects.views.private.project_version_delete_html', + 'readthedocs.projects.views.private.project_version_delete_html', name='project_version_delete_html'), url(r'^(?P[-\w]+)/version/(?P[^/]+)/$', - 'projects.views.private.project_version_detail', + 'readthedocs.projects.views.private.project_version_detail', name='project_version_detail'), url(r'^(?P[-\w]+)/versions/$', - 'projects.views.private.project_versions', + 'readthedocs.projects.views.private.project_versions', name='projects_versions'), url(r'^(?P[-\w]+)/delete/$', - 'projects.views.private.project_delete', + 'readthedocs.projects.views.private.project_delete', name='projects_delete'), url(r'^(?P[-\w]+)/subprojects/delete/(?P[-\w]+)/$', # noqa - 'projects.views.private.project_subprojects_delete', + 'readthedocs.projects.views.private.project_subprojects_delete', name='projects_subprojects_delete'), url(r'^(?P[-\w]+)/subprojects/$', - 'projects.views.private.project_subprojects', + 'readthedocs.projects.views.private.project_subprojects', name='projects_subprojects'), url(r'^(?P[-\w]+)/users/$', - 'projects.views.private.project_users', + 'readthedocs.projects.views.private.project_users', name='projects_users'), url(r'^(?P[-\w]+)/users/delete/$', - 'projects.views.private.project_users_delete', + 'readthedocs.projects.views.private.project_users_delete', name='projects_users_delete'), url(r'^(?P[-\w]+)/notifications/$', - 'projects.views.private.project_notifications', + 'readthedocs.projects.views.private.project_notifications', name='projects_notifications'), url(r'^(?P[-\w]+)/comments/$', - 'projects.views.private.project_comments_settings', + 'readthedocs.projects.views.private.project_comments_settings', name='projects_comments'), url(r'^(?P[-\w]+)/notifications/delete/$', - 'projects.views.private.project_notifications_delete', + 'readthedocs.projects.views.private.project_notifications_delete', name='projects_notification_delete'), url(r'^(?P[-\w]+)/translations/$', - 'projects.views.private.project_translations', + 'readthedocs.projects.views.private.project_translations', name='projects_translations'), url(r'^(?P[-\w]+)/translations/delete/(?P[-\w]+)/$', # noqa - 'projects.views.private.project_translations_delete', + 'readthedocs.projects.views.private.project_translations_delete', name='projects_translations_delete'), url(r'^(?P[-\w]+)/redirects/$', - 'projects.views.private.project_redirects', + 'readthedocs.projects.views.private.project_redirects', name='projects_redirects'), url(r'^(?P[-\w]+)/redirects/delete/$', - 'projects.views.private.project_redirects_delete', + 'readthedocs.projects.views.private.project_redirects_delete', name='projects_redirects_delete'), ) diff --git a/readthedocs/projects/urls/public.py b/readthedocs/projects/urls/public.py index f36d2bc9557..7bb92ee6167 100644 --- a/readthedocs/projects/urls/public.py +++ b/readthedocs/projects/urls/public.py @@ -1,6 +1,6 @@ from django.conf.urls import patterns, url -from projects.views.public import ProjectIndex, ProjectDetailView +from readthedocs.projects.views.public import ProjectIndex, ProjectDetailView urlpatterns = patterns( @@ -11,15 +11,15 @@ name='projects_list'), url(r'^search/autocomplete/$', - 'projects.views.public.search_autocomplete', + 'readthedocs.projects.views.public.search_autocomplete', name='search_autocomplete'), url(r'^autocomplete/version/(?P[-\w]+)/$', - 'projects.views.public.version_autocomplete', + 'readthedocs.projects.views.public.version_autocomplete', name='version_autocomplete'), url(r'^autocomplete/filter/version/(?P[-\w]+)/$', - 'projects.views.public.version_filter_autocomplete', + 'readthedocs.projects.views.public.version_filter_autocomplete', name='version_filter_autocomplete'), url(r'^tags/(?P[-\w]+)/$', @@ -31,35 +31,35 @@ name='projects_detail'), url(r'^(?P[-\w]+)/downloads/$', - 'projects.views.public.project_downloads', + 'readthedocs.projects.views.public.project_downloads', name='project_downloads'), url(r'^(?P[-\w]+)/downloads/(?P[-\w]+)/(?P[-\w.]+)/$', - 'projects.views.public.project_download_media', + 'readthedocs.projects.views.public.project_download_media', name='project_download_media'), url(r'^(?P[-\w]+)/badge/$', - 'projects.views.public.project_badge', + 'readthedocs.projects.views.public.project_badge', name='project_badge'), url(r'^(?P[-\w]+)/versions/$', - 'projects.views.public.project_versions', + 'readthedocs.projects.views.public.project_versions', name='project_version_list'), url(r'^(?P[-\w]+)/tools/embed/$', - 'projects.views.public.project_embed', + 'readthedocs.projects.views.public.project_embed', name='project_embed'), url(r'^(?P[-\w]+)/search/$', - 'projects.views.public.elastic_project_search', + 'readthedocs.projects.views.public.elastic_project_search', name='elastic_project_search'), url(r'^(?P[-\w]+)/autocomplete/file/$', - 'projects.views.public.file_autocomplete', + 'readthedocs.projects.views.public.file_autocomplete', name='file_autocomplete'), url(r'^(?P\w+)/$', - 'projects.views.public.project_index', + 'readthedocs.projects.views.public.project_index', name='projects_user_list'), ) diff --git a/readthedocs/projects/utils.py b/readthedocs/projects/utils.py index 4b08acb3959..4c99c95689a 100644 --- a/readthedocs/projects/utils.py +++ b/readthedocs/projects/utils.py @@ -11,15 +11,15 @@ from django.conf import settings import redis -from builds.constants import LATEST +from readthedocs.builds.constants import LATEST log = logging.getLogger(__name__) def version_from_slug(slug, version): - from projects import tasks - from builds.models import Version - from restapi.client import api + from readthedocs.projects import tasks + from readthedocs.builds.models import Version + from readthedocs.restapi.client import api if getattr(settings, 'DONT_HIT_DB', True): version_data = api.version().get(project=slug, slug=version)['results'][0] v = tasks.make_api_version(version_data) @@ -28,7 +28,7 @@ def version_from_slug(slug, version): return v def symlink(project, version=LATEST): - from projects import symlinks + from readthedocs.projects import symlinks v = version_from_slug(project, version) log.info("Symlinking %s" % v) symlinks.symlink_subprojects(v) @@ -39,7 +39,7 @@ def update_static_metadata(project_pk): """ This is here to avoid circular imports in models.py """ - from projects import tasks + from readthedocs.projects import tasks tasks.update_static_metadata.delay(project_pk) def find_file(file): @@ -161,7 +161,7 @@ def _new_save(*args, **kwargs): return 0 def make_api_version(version_data): - from builds.models import Version + from readthedocs.builds.models import Version for key in ['resource_uri', 'absolute_url', 'downloads']: if key in version_data: del version_data[key] @@ -175,7 +175,7 @@ def make_api_version(version_data): def make_api_project(project_data): - from projects.models import Project + from readthedocs.projects.models import Project for key in ['users', 'resource_uri', 'absolute_url', 'downloads', 'main_language_project', 'related_projects']: if key in project_data: del project_data[key] diff --git a/readthedocs/projects/version_handling.py b/readthedocs/projects/version_handling.py index d7b64ddf7d6..8e0f050515c 100644 --- a/readthedocs/projects/version_handling.py +++ b/readthedocs/projects/version_handling.py @@ -2,8 +2,8 @@ from packaging.version import Version from packaging.version import InvalidVersion -from builds.constants import LATEST_VERBOSE_NAME -from builds.constants import STABLE_VERBOSE_NAME +from readthedocs.builds.constants import LATEST_VERBOSE_NAME +from readthedocs.builds.constants import STABLE_VERBOSE_NAME def get_major(version): diff --git a/readthedocs/projects/views/base.py b/readthedocs/projects/views/base.py index 72d1ef354e5..f651a7afa1e 100644 --- a/readthedocs/projects/views/base.py +++ b/readthedocs/projects/views/base.py @@ -1,4 +1,4 @@ -from projects.models import Project +from readthedocs.projects.models import Project class ProjectOnboardMixin(object): diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index 17475b453d0..a1ad15363b7 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -18,28 +18,28 @@ from allauth.socialaccount.models import SocialToken from requests_oauthlib import OAuth2Session -from bookmarks.models import Bookmark -from builds import utils as build_utils -from builds.models import Version -from builds.forms import AliasForm, VersionForm -from builds.filters import VersionFilter -from builds.models import VersionAlias -from core.utils import trigger_build -from oauth.models import GithubProject, BitbucketProject -from oauth import utils as oauth_utils -from projects.forms import (ProjectBackendForm, ProjectBasicsForm, +from readthedocs.bookmarks.models import Bookmark +from readthedocs.builds import utils as build_utils +from readthedocs.builds.models import Version +from readthedocs.builds.forms import AliasForm, VersionForm +from readthedocs.builds.filters import VersionFilter +from readthedocs.builds.models import VersionAlias +from readthedocs.core.utils import trigger_build +from readthedocs.oauth.models import GithubProject, BitbucketProject +from readthedocs.oauth import utils as oauth_utils +from readthedocs.projects.forms import (ProjectBackendForm, ProjectBasicsForm, ProjectExtraForm, ProjectAdvancedForm, UpdateProjectForm, SubprojectForm, build_versions_form, UserForm, EmailHookForm, TranslationForm, RedirectForm, WebHookForm) -from projects.models import Project, EmailHook, WebHook -from projects import constants, tasks +from readthedocs.projects.models import Project, EmailHook, WebHook +from readthedocs.projects import constants, tasks try: from readthedocs.projects.signals import project_import except: - from projects.signals import project_import + from readthedocs.projects.signals import project_import log = logging.getLogger(__name__) diff --git a/readthedocs/projects/views/public.py b/readthedocs/projects/views/public.py index 8b0428dfdbf..310a9e1b341 100644 --- a/readthedocs/projects/views/public.py +++ b/readthedocs/projects/views/public.py @@ -22,12 +22,12 @@ import requests from .base import ProjectOnboardMixin -from builds.constants import LATEST -from builds.filters import VersionSlugFilter -from builds.models import Version -from projects.models import Project, ImportedFile -from search.indexes import PageIndex -from search.views import LOG_TEMPLATE +from readthedocs.builds.constants import LATEST +from readthedocs.builds.filters import VersionSlugFilter +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project, ImportedFile +from readthedocs.search.indexes import PageIndex +from readthedocs.search.views import LOG_TEMPLATE log = logging.getLogger(__name__) search_log = logging.getLogger(__name__ + '.search') diff --git a/readthedocs/redirects/models.py b/readthedocs/redirects/models.py index 8db2a79d2d2..d3c66a4d50e 100644 --- a/readthedocs/redirects/models.py +++ b/readthedocs/redirects/models.py @@ -2,7 +2,7 @@ from django.utils.translation import ugettext from django.utils.translation import ugettext_lazy as _ -from projects.models import Project +from readthedocs.projects.models import Project HTTP_STATUS_CHOICES = ( (301, _('301 - Permanent Redirect')), diff --git a/readthedocs/restapi/permissions.py b/readthedocs/restapi/permissions.py index 89cfe103804..135f239a5ef 100644 --- a/readthedocs/restapi/permissions.py +++ b/readthedocs/restapi/permissions.py @@ -1,5 +1,5 @@ from rest_framework import permissions -from privacy.backend import AdminPermission +from readthedocs.privacy.backend import AdminPermission class IsOwner(permissions.BasePermission): diff --git a/readthedocs/restapi/serializers.py b/readthedocs/restapi/serializers.py index a590f70d9bc..a97dc0918aa 100644 --- a/readthedocs/restapi/serializers.py +++ b/readthedocs/restapi/serializers.py @@ -1,7 +1,7 @@ from rest_framework import serializers -from builds.models import Build, Version -from projects.models import Project +from readthedocs.builds.models import Build, Version +from readthedocs.projects.models import Project class ProjectSerializer(serializers.ModelSerializer): diff --git a/readthedocs/restapi/urls.py b/readthedocs/restapi/urls.py index 98907d93a01..97f5fd1817a 100644 --- a/readthedocs/restapi/urls.py +++ b/readthedocs/restapi/urls.py @@ -3,7 +3,7 @@ from rest_framework import routers from .views.model_views import BuildViewSet, ProjectViewSet, NotificationViewSet, VersionViewSet -from comments.views import CommentViewSet +from readthedocs.comments.views import CommentViewSet router = routers.DefaultRouter() router.register(r'build', BuildViewSet) @@ -15,12 +15,12 @@ urlpatterns = patterns( '', url(r'^', include(router.urls)), - url(r'embed/', 'restapi.views.core_views.embed', name='embed'), - url(r'docurl/', 'restapi.views.core_views.docurl', name='docurl'), - url(r'cname/', 'restapi.views.core_views.cname', name='cname'), - url(r'footer_html/', 'restapi.views.footer_views.footer_html', name='footer_html'), - url(r'index_search/', 'restapi.views.search_views.index_search', name='index_search'), - url(r'search/$', 'restapi.views.search_views.search', name='api_search'), - url(r'search/project/$', 'restapi.views.search_views.project_search', name='api_project_search'), - url(r'search/section/$', 'restapi.views.search_views.section_search', name='api_section_search'), + url(r'embed/', 'readthedocs.restapi.views.core_views.embed', name='embed'), + url(r'docurl/', 'readthedocs.restapi.views.core_views.docurl', name='docurl'), + url(r'cname/', 'readthedocs.restapi.views.core_views.cname', name='cname'), + url(r'footer_html/', 'readthedocs.restapi.views.footer_views.footer_html', name='footer_html'), + url(r'index_search/', 'readthedocs.restapi.views.search_views.index_search', name='index_search'), + url(r'search/$', 'readthedocs.restapi.views.search_views.search', name='api_search'), + url(r'search/project/$', 'readthedocs.restapi.views.search_views.project_search', name='api_project_search'), + url(r'search/section/$', 'readthedocs.restapi.views.search_views.section_search', name='api_section_search'), ) diff --git a/readthedocs/restapi/utils.py b/readthedocs/restapi/utils.py index d44a2e492b5..1afd5d08422 100644 --- a/readthedocs/restapi/utils.py +++ b/readthedocs/restapi/utils.py @@ -3,9 +3,9 @@ import requests -from builds.constants import NON_REPOSITORY_VERSIONS -from builds.models import Version -from search.indexes import PageIndex, ProjectIndex, SectionIndex +from readthedocs.builds.constants import NON_REPOSITORY_VERSIONS +from readthedocs.builds.models import Version +from readthedocs.search.indexes import PageIndex, ProjectIndex, SectionIndex log = logging.getLogger(__name__) diff --git a/readthedocs/restapi/views/core_views.py b/readthedocs/restapi/views/core_views.py index 0b80759b928..bbfe3c0d4b6 100644 --- a/readthedocs/restapi/views/core_views.py +++ b/readthedocs/restapi/views/core_views.py @@ -9,11 +9,11 @@ from django.core.cache import cache from django.shortcuts import get_object_or_404 -from core.utils import clean_url, cname_to_slug -from builds.constants import LATEST -from builds.models import Version -from projects.models import Project -from core.templatetags.core_tags import make_document_url +from readthedocs.core.utils import clean_url, cname_to_slug +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project +from readthedocs.core.templatetags.core_tags import make_document_url @decorators.api_view(['GET']) diff --git a/readthedocs/restapi/views/footer_views.py b/readthedocs/restapi/views/footer_views.py index 9a8afcdf31e..ef8af615252 100644 --- a/readthedocs/restapi/views/footer_views.py +++ b/readthedocs/restapi/views/footer_views.py @@ -7,9 +7,9 @@ from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer from rest_framework.response import Response -from builds.models import Version -from projects.models import Project -from donate.models import SupporterPromo +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project +from readthedocs.donate.models import SupporterPromo @decorators.api_view(['GET']) diff --git a/readthedocs/restapi/views/model_views.py b/readthedocs/restapi/views/model_views.py index 555f4ff1191..a1e1c90be30 100644 --- a/readthedocs/restapi/views/model_views.py +++ b/readthedocs/restapi/views/model_views.py @@ -7,18 +7,18 @@ from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer from rest_framework.response import Response -from builds.filters import VersionFilter -from builds.models import Build, Version -from core.utils import trigger_build -from oauth import utils as oauth_utils -from builds.constants import STABLE -from projects.filters import ProjectFilter -from projects.models import Project, EmailHook -from projects.version_handling import determine_stable_version -from restapi.permissions import APIPermission -from restapi.permissions import RelatedProjectIsOwner -from restapi.serializers import BuildSerializer, ProjectSerializer, VersionSerializer -import restapi.utils as api_utils +from readthedocs.builds.filters import VersionFilter +from readthedocs.builds.models import Build, Version +from readthedocs.core.utils import trigger_build +from readthedocs.oauth import utils as oauth_utils +from readthedocs.builds.constants import STABLE +from readthedocs.projects.filters import ProjectFilter +from readthedocs.projects.models import Project, EmailHook +from readthedocs.projects.version_handling import determine_stable_version +from readthedocs.restapi.permissions import APIPermission +from readthedocs.restapi.permissions import RelatedProjectIsOwner +from readthedocs.restapi.serializers import BuildSerializer, ProjectSerializer, VersionSerializer +import readthedocs.restapi.utils as api_utils log = logging.getLogger(__name__) diff --git a/readthedocs/restapi/views/search_views.py b/readthedocs/restapi/views/search_views.py index 36928716d00..5c3694f215a 100644 --- a/readthedocs/restapi/views/search_views.py +++ b/readthedocs/restapi/views/search_views.py @@ -5,11 +5,11 @@ from rest_framework.response import Response import requests -from builds.constants import LATEST -from builds.models import Version -from search.indexes import PageIndex, ProjectIndex, SectionIndex -from projects.models import Project -from restapi import utils +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Version +from readthedocs.search.indexes import PageIndex, ProjectIndex, SectionIndex +from readthedocs.projects.models import Project +from readthedocs.restapi import utils log = logging.getLogger(__name__) diff --git a/readthedocs/rtd_tests/base.py b/readthedocs/rtd_tests/base.py index 1536f0befd7..36c4b67f777 100644 --- a/readthedocs/rtd_tests/base.py +++ b/readthedocs/rtd_tests/base.py @@ -23,7 +23,7 @@ def tearDown(self): shutil.rmtree(self.build_dir) -@patch('projects.views.private.trigger_build', lambda x, basic: None) +@patch('readthedocs.projects.views.private.trigger_build', lambda x, basic: None) @patch('readthedocs.projects.views.private.trigger_build', lambda x, basic: None) class MockBuildTestCase(TestCase): '''Mock build triggers for test cases''' @@ -37,7 +37,7 @@ class WizardTestCase(TestCase): url = None wizard_class_slug = None - @patch('projects.views.private.trigger_build', lambda x, basic: None) + @patch('readthedocs.projects.views.private.trigger_build', lambda x, basic: None) @patch('readthedocs.projects.views.private.trigger_build', lambda x, basic: None) def post_step(self, step, **data): '''Post step form data to `url`, using supplimentary `kwargs` diff --git a/readthedocs/rtd_tests/factories/comments_factories.py b/readthedocs/rtd_tests/factories/comments_factories.py index 1e190262190..c6db4f738b9 100644 --- a/readthedocs/rtd_tests/factories/comments_factories.py +++ b/readthedocs/rtd_tests/factories/comments_factories.py @@ -3,9 +3,9 @@ import factory -from comments.models import DocumentComment, DocumentNode, NodeSnapshot -from rtd_tests.factories.general_factories import UserFactory -from rtd_tests.factories.projects_factories import ProjectFactory +from readthedocs.comments.models import DocumentComment, DocumentNode, NodeSnapshot +from readthedocs.rtd_tests.factories.general_factories import UserFactory +from readthedocs.rtd_tests.factories.projects_factories import ProjectFactory class SnapshotFactory(factory.DjangoModelFactory): diff --git a/readthedocs/rtd_tests/factories/projects_factories.py b/readthedocs/rtd_tests/factories/projects_factories.py index 6cc5240c4be..369af148c30 100644 --- a/readthedocs/rtd_tests/factories/projects_factories.py +++ b/readthedocs/rtd_tests/factories/projects_factories.py @@ -1,6 +1,6 @@ import factory -from projects.models import Project -from builds.models import Version +from readthedocs.projects.models import Project +from readthedocs.builds.models import Version from bamboo_boy.materials import Clump diff --git a/readthedocs/rtd_tests/tests/test_404.py b/readthedocs/rtd_tests/tests/test_404.py index c1d27926f9b..af2f5579e74 100644 --- a/readthedocs/rtd_tests/tests/test_404.py +++ b/readthedocs/rtd_tests/tests/test_404.py @@ -2,7 +2,7 @@ from django.test import TestCase -from projects.models import Project +from readthedocs.projects.models import Project class Testmaker(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_backend.py b/readthedocs/rtd_tests/tests/test_backend.py index 165676229e6..af5a8d96274 100644 --- a/readthedocs/rtd_tests/tests/test_backend.py +++ b/readthedocs/rtd_tests/tests/test_backend.py @@ -2,10 +2,10 @@ from django.contrib.auth.models import User -from projects.models import Project -from rtd_tests.base import RTDTestCase +from readthedocs.projects.models import Project +from readthedocs.rtd_tests.base import RTDTestCase -from rtd_tests.utils import make_test_git, make_test_hg +from readthedocs.rtd_tests.utils import make_test_git, make_test_hg class TestGitBackend(RTDTestCase): diff --git a/readthedocs/rtd_tests/tests/test_bookmarks.py b/readthedocs/rtd_tests/tests/test_bookmarks.py index 59c840bf456..e2184e9dd53 100644 --- a/readthedocs/rtd_tests/tests/test_bookmarks.py +++ b/readthedocs/rtd_tests/tests/test_bookmarks.py @@ -3,9 +3,9 @@ from django.contrib.auth.models import User import json -from builds.constants import LATEST -from projects.models import Project -from bookmarks.models import Bookmark +from readthedocs.builds.constants import LATEST +from readthedocs.projects.models import Project +from readthedocs.bookmarks.models import Bookmark class TestBookmarks(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_builds.py b/readthedocs/rtd_tests/tests/test_builds.py index aefc7b15ed9..5db30652401 100644 --- a/readthedocs/rtd_tests/tests/test_builds.py +++ b/readthedocs/rtd_tests/tests/test_builds.py @@ -4,10 +4,10 @@ from django.test import TestCase import mock -from projects.tasks import build_docs -from rtd_tests.factories.projects_factories import ProjectFactory -from rtd_tests.mocks.paths import fake_paths_lookup -from doc_builder.loader import get_builder_class +from readthedocs.projects.tasks import build_docs +from readthedocs.rtd_tests.factories.projects_factories import ProjectFactory +from readthedocs.rtd_tests.mocks.paths import fake_paths_lookup +from readthedocs.doc_builder.loader import get_builder_class class MockProcess(object): diff --git a/readthedocs/rtd_tests/tests/test_canonical.py b/readthedocs/rtd_tests/tests/test_canonical.py index 71267cd5d51..8b754b8bd74 100644 --- a/readthedocs/rtd_tests/tests/test_canonical.py +++ b/readthedocs/rtd_tests/tests/test_canonical.py @@ -1,5 +1,5 @@ from django.test import TestCase -from projects.models import Project +from readthedocs.projects.models import Project class TestCanonical(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_celery.py b/readthedocs/rtd_tests/tests/test_celery.py index a4fdf2d079b..29337cc4f95 100644 --- a/readthedocs/rtd_tests/tests/test_celery.py +++ b/readthedocs/rtd_tests/tests/test_celery.py @@ -5,12 +5,12 @@ from django.contrib.auth.models import User import json -from projects.models import Project -from projects import tasks +from readthedocs.projects.models import Project +from readthedocs.projects import tasks -from rtd_tests.utils import make_test_git -from rtd_tests.base import RTDTestCase -from rtd_tests.mocks.mock_api import mock_api +from readthedocs.rtd_tests.utils import make_test_git +from readthedocs.rtd_tests.base import RTDTestCase +from readthedocs.rtd_tests.mocks.mock_api import mock_api class TestCeleryBuilding(RTDTestCase): diff --git a/readthedocs/rtd_tests/tests/test_comments.py b/readthedocs/rtd_tests/tests/test_comments.py index 2b28660924f..91d957ae9a1 100644 --- a/readthedocs/rtd_tests/tests/test_comments.py +++ b/readthedocs/rtd_tests/tests/test_comments.py @@ -8,14 +8,14 @@ from django.utils.decorators import method_decorator from rest_framework.test import APIRequestFactory, APITestCase -from comments.models import DocumentNode, DocumentComment, NodeSnapshot -from comments.views import add_node, get_metadata, update_node -from privacy.backend import AdminNotAuthorized -from projects.views.private import project_comments_moderation -from rtd_tests.factories.comments_factories import DocumentNodeFactory, \ +from readthedocs.comments.models import DocumentNode, DocumentComment, NodeSnapshot +from readthedocs.comments.views import add_node, get_metadata, update_node +from readthedocs.privacy.backend import AdminNotAuthorized +from readthedocs.projects.views.private import project_comments_moderation +from readthedocs.rtd_tests.factories.comments_factories import DocumentNodeFactory, \ DocumentCommentFactory, ProjectsWithComments -from rtd_tests.factories.general_factories import UserFactory -from rtd_tests.factories.projects_factories import ProjectFactory +from readthedocs.rtd_tests.factories.general_factories import UserFactory +from readthedocs.rtd_tests.factories.projects_factories import ProjectFactory @with_canopy(ProjectsWithComments) diff --git a/readthedocs/rtd_tests/tests/test_core_management.py b/readthedocs/rtd_tests/tests/test_core_management.py index 2a27b2e3324..7e498eb6a96 100644 --- a/readthedocs/rtd_tests/tests/test_core_management.py +++ b/readthedocs/rtd_tests/tests/test_core_management.py @@ -3,9 +3,9 @@ from django.test import TestCase from mock import patch -from core.management.commands import run_docker -from projects.models import Project -from builds.models import Version +from readthedocs.core.management.commands import run_docker +from readthedocs.projects.models import Project +from readthedocs.builds.models import Version class TestRunDocker(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_core_tags.py b/readthedocs/rtd_tests/tests/test_core_tags.py index e65ae719ef2..c021dc8b2ec 100644 --- a/readthedocs/rtd_tests/tests/test_core_tags.py +++ b/readthedocs/rtd_tests/tests/test_core_tags.py @@ -1,8 +1,8 @@ from django.test import TestCase -from projects.models import Project -from builds.constants import LATEST -from builds.models import Version -from core.templatetags import core_tags +from readthedocs.projects.models import Project +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Version +from readthedocs.core.templatetags import core_tags class CoreTagsTests(TestCase): fixtures = ["eric", "test_data"] diff --git a/readthedocs/rtd_tests/tests/test_doc_building.py b/readthedocs/rtd_tests/tests/test_doc_building.py index f80dcdf8841..05adf38e954 100644 --- a/readthedocs/rtd_tests/tests/test_doc_building.py +++ b/readthedocs/rtd_tests/tests/test_doc_building.py @@ -6,12 +6,12 @@ from django.test import TestCase from django.contrib.auth.models import User -from projects.models import Project -from builds.models import Version -from doc_builder.environments import (DockerEnvironment, DockerBuildCommand, +from readthedocs.projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.doc_builder.environments import (DockerEnvironment, DockerBuildCommand, BuildCommand) -from rtd_tests.utils import make_test_git -from rtd_tests.base import RTDTestCase +from readthedocs.rtd_tests.utils import make_test_git +from readthedocs.rtd_tests.base import RTDTestCase class TestBuilding(RTDTestCase): diff --git a/readthedocs/rtd_tests/tests/test_footer.py b/readthedocs/rtd_tests/tests/test_footer.py index 5be4614ca32..df8bc3c2e69 100644 --- a/readthedocs/rtd_tests/tests/test_footer.py +++ b/readthedocs/rtd_tests/tests/test_footer.py @@ -2,8 +2,8 @@ from django.test import TestCase -from rtd_tests.mocks.paths import fake_paths_by_regex -from projects.models import Project +from readthedocs.rtd_tests.mocks.paths import fake_paths_by_regex +from readthedocs.projects.models import Project class Testmaker(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_hacks.py b/readthedocs/rtd_tests/tests/test_hacks.py index 4b45ddf5070..31125ec68a6 100644 --- a/readthedocs/rtd_tests/tests/test_hacks.py +++ b/readthedocs/rtd_tests/tests/test_hacks.py @@ -1,5 +1,5 @@ from django.test import TestCase -from core import hacks +from readthedocs.core import hacks class TestHacks(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_middleware.py b/readthedocs/rtd_tests/tests/test_middleware.py index e1f81c59f7b..c56ee22769c 100644 --- a/readthedocs/rtd_tests/tests/test_middleware.py +++ b/readthedocs/rtd_tests/tests/test_middleware.py @@ -4,7 +4,7 @@ from django.test.client import RequestFactory from django.test.utils import override_settings -from core.middleware import SubdomainMiddleware +from readthedocs.core.middleware import SubdomainMiddleware class MiddlewareTests(unittest.TestCase): diff --git a/readthedocs/rtd_tests/tests/test_oauth.py b/readthedocs/rtd_tests/tests/test_oauth.py index 303412b1916..4e064dc5ee7 100644 --- a/readthedocs/rtd_tests/tests/test_oauth.py +++ b/readthedocs/rtd_tests/tests/test_oauth.py @@ -3,10 +3,10 @@ from django.contrib.auth.models import User from allauth.socialaccount.models import SocialToken -from projects.models import Project +from readthedocs.projects.models import Project -from oauth.utils import make_github_project, make_github_organization, import_github -from oauth.models import GithubOrganization, GithubProject +from readthedocs.oauth.utils import make_github_project, make_github_organization, import_github +from readthedocs.oauth.models import GithubOrganization, GithubProject class RedirectOauth(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_post_commit_hooks.py b/readthedocs/rtd_tests/tests/test_post_commit_hooks.py index bf30a68ae95..64ee34ed2e7 100644 --- a/readthedocs/rtd_tests/tests/test_post_commit_hooks.py +++ b/readthedocs/rtd_tests/tests/test_post_commit_hooks.py @@ -2,8 +2,8 @@ import json import logging -from projects.models import Project -from projects import tasks +from readthedocs.projects.models import Project +from readthedocs.projects import tasks log = logging.getLogger(__name__) diff --git a/readthedocs/rtd_tests/tests/test_privacy.py b/readthedocs/rtd_tests/tests/test_privacy.py index d7e9689fe8a..f16e162b7c4 100644 --- a/readthedocs/rtd_tests/tests/test_privacy.py +++ b/readthedocs/rtd_tests/tests/test_privacy.py @@ -5,11 +5,11 @@ from django.test.utils import override_settings from django.contrib.auth.models import User -from builds.constants import LATEST -from builds.models import Version -from projects.models import Project -from projects.forms import UpdateProjectForm -from projects import tasks +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project +from readthedocs.projects.forms import UpdateProjectForm +from readthedocs.projects import tasks log = logging.getLogger(__name__) diff --git a/readthedocs/rtd_tests/tests/test_project.py b/readthedocs/rtd_tests/tests/test_project.py index 30b9f527295..b6d74fe1338 100644 --- a/readthedocs/rtd_tests/tests/test_project.py +++ b/readthedocs/rtd_tests/tests/test_project.py @@ -1,13 +1,13 @@ from bamboo_boy.utils import with_canopy import json from django.test import TestCase -from builds.constants import LATEST -from projects.models import Project -from rtd_tests.factories.projects_factories import OneProjectWithTranslationsOneWithout,\ +from readthedocs.builds.constants import LATEST +from readthedocs.projects.models import Project +from readthedocs.rtd_tests.factories.projects_factories import OneProjectWithTranslationsOneWithout,\ ProjectFactory from rest_framework.reverse import reverse -from restapi.serializers import ProjectSerializer -from rtd_tests.mocks.paths import fake_paths_by_regex +from readthedocs.restapi.serializers import ProjectSerializer +from readthedocs.rtd_tests.mocks.paths import fake_paths_by_regex @with_canopy(OneProjectWithTranslationsOneWithout) diff --git a/readthedocs/rtd_tests/tests/test_project_symlinks.py b/readthedocs/rtd_tests/tests/test_project_symlinks.py index e10a2817614..6e226be44de 100644 --- a/readthedocs/rtd_tests/tests/test_project_symlinks.py +++ b/readthedocs/rtd_tests/tests/test_project_symlinks.py @@ -4,9 +4,9 @@ from mock import patch from django.test import TestCase -from builds.models import Version -from projects.models import Project -from projects.symlinks import symlink_translations +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project +from readthedocs.projects.symlinks import symlink_translations def patched(fn): diff --git a/readthedocs/rtd_tests/tests/test_project_views.py b/readthedocs/rtd_tests/tests/test_project_views.py index 75fc2d5bbc9..f9f09f75830 100644 --- a/readthedocs/rtd_tests/tests/test_project_views.py +++ b/readthedocs/rtd_tests/tests/test_project_views.py @@ -2,8 +2,8 @@ from django.contrib.messages import constants as message_const -from rtd_tests.base import WizardTestCase, MockBuildTestCase -from projects.models import Project +from readthedocs.rtd_tests.base import WizardTestCase, MockBuildTestCase +from readthedocs.projects.models import Project class TestBasicsForm(WizardTestCase): diff --git a/readthedocs/rtd_tests/tests/test_redirects.py b/readthedocs/rtd_tests/tests/test_redirects.py index c3ca308ab5e..feccf5ef7c5 100644 --- a/readthedocs/rtd_tests/tests/test_redirects.py +++ b/readthedocs/rtd_tests/tests/test_redirects.py @@ -1,9 +1,9 @@ from django.test import TestCase from django.test.utils import override_settings -from builds.constants import LATEST -from projects.models import Project -from redirects.models import Redirect +from readthedocs.builds.constants import LATEST +from readthedocs.projects.models import Project +from readthedocs.redirects.models import Redirect import logging diff --git a/readthedocs/rtd_tests/tests/test_redirects_utils.py b/readthedocs/rtd_tests/tests/test_redirects_utils.py index 82940322148..4781ce3c98a 100644 --- a/readthedocs/rtd_tests/tests/test_redirects_utils.py +++ b/readthedocs/rtd_tests/tests/test_redirects_utils.py @@ -1,9 +1,9 @@ from django.test import TestCase from django.test.utils import override_settings -from projects.models import Project +from readthedocs.projects.models import Project from django.core.urlresolvers import reverse -from redirects.utils import redirect_filename +from readthedocs.redirects.utils import redirect_filename class RedirectFilenameTests(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_repo_parsing.py b/readthedocs/rtd_tests/tests/test_repo_parsing.py index 5cfc4bf9016..d95f9687d82 100644 --- a/readthedocs/rtd_tests/tests/test_repo_parsing.py +++ b/readthedocs/rtd_tests/tests/test_repo_parsing.py @@ -2,7 +2,7 @@ from django.test import TestCase -from projects.models import Project +from readthedocs.projects.models import Project class TestRepoParsing(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_search_json_parsing.py b/readthedocs/rtd_tests/tests/test_search_json_parsing.py index 1f2ce2fafc3..b51ea834f1e 100644 --- a/readthedocs/rtd_tests/tests/test_search_json_parsing.py +++ b/readthedocs/rtd_tests/tests/test_search_json_parsing.py @@ -2,7 +2,7 @@ from django.test import TestCase -from search.parse_json import process_file +from readthedocs.search.parse_json import process_file base_dir = os.path.dirname(os.path.dirname(__file__)) diff --git a/readthedocs/rtd_tests/tests/test_single_version.py b/readthedocs/rtd_tests/tests/test_single_version.py index 3244c951f8f..c98390eefa3 100644 --- a/readthedocs/rtd_tests/tests/test_single_version.py +++ b/readthedocs/rtd_tests/tests/test_single_version.py @@ -1,8 +1,8 @@ from django.test import TestCase -from builds.constants import LATEST -from builds.models import Version -from projects.models import Project +from readthedocs.builds.constants import LATEST +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project class RedirectSingleVersionTests(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_supported.py b/readthedocs/rtd_tests/tests/test_supported.py index 7ee3d36d072..3dc33d219f1 100644 --- a/readthedocs/rtd_tests/tests/test_supported.py +++ b/readthedocs/rtd_tests/tests/test_supported.py @@ -2,8 +2,8 @@ from django.test import TestCase -from builds.models import Version -from projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project class TestSupportedVersions(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_sync_versions.py b/readthedocs/rtd_tests/tests/test_sync_versions.py index 615710923bc..fe23f6c032d 100644 --- a/readthedocs/rtd_tests/tests/test_sync_versions.py +++ b/readthedocs/rtd_tests/tests/test_sync_versions.py @@ -2,9 +2,9 @@ from django.test import TestCase -from builds.models import Version -from builds.constants import STABLE -from projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.builds.constants import STABLE +from readthedocs.projects.models import Project class TestSyncVersions(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_urls.py b/readthedocs/rtd_tests/tests/test_urls.py index 79ec5538043..87fb08515da 100644 --- a/readthedocs/rtd_tests/tests/test_urls.py +++ b/readthedocs/rtd_tests/tests/test_urls.py @@ -2,8 +2,8 @@ from django.core.urlresolvers import NoReverseMatch from django.test import TestCase -from builds.constants import LATEST -import core.views +from readthedocs.builds.constants import LATEST +import readthedocs.core.views class SubdomainUrlTests(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_version_slug.py b/readthedocs/rtd_tests/tests/test_version_slug.py index 3277149cefb..c9539205eed 100644 --- a/readthedocs/rtd_tests/tests/test_version_slug.py +++ b/readthedocs/rtd_tests/tests/test_version_slug.py @@ -1,10 +1,10 @@ import re from django.test import TestCase -from builds.models import Version -from builds.version_slug import VersionSlugField -from builds.version_slug import VERSION_SLUG_REGEX -from projects.models import Project +from readthedocs.builds.models import Version +from readthedocs.builds.version_slug import VersionSlugField +from readthedocs.builds.version_slug import VERSION_SLUG_REGEX +from readthedocs.projects.models import Project class VersionSlugPatternTests(TestCase): diff --git a/readthedocs/rtd_tests/tests/test_version_windows.py b/readthedocs/rtd_tests/tests/test_version_windows.py index 835f52c908a..6fb5eb78f75 100644 --- a/readthedocs/rtd_tests/tests/test_version_windows.py +++ b/readthedocs/rtd_tests/tests/test_version_windows.py @@ -1,6 +1,6 @@ import unittest -from projects.version_handling import version_windows +from readthedocs.projects.version_handling import version_windows class TestVersionWindows(unittest.TestCase): diff --git a/readthedocs/rtd_tests/tests/test_views.py b/readthedocs/rtd_tests/tests/test_views.py index 13fd4bb15ed..1bdc7c5842a 100644 --- a/readthedocs/rtd_tests/tests/test_views.py +++ b/readthedocs/rtd_tests/tests/test_views.py @@ -3,9 +3,9 @@ from django.test import TestCase from django.utils.six.moves.urllib.parse import urlsplit -from builds.constants import LATEST -from projects.models import Project -from projects.forms import UpdateProjectForm +from readthedocs.builds.constants import LATEST +from readthedocs.projects.models import Project +from readthedocs.projects.forms import UpdateProjectForm class Testmaker(TestCase): diff --git a/readthedocs/search/lib.py b/readthedocs/search/lib.py index 59c70886d4a..d38661e0444 100644 --- a/readthedocs/search/lib.py +++ b/readthedocs/search/lib.py @@ -1,11 +1,11 @@ -from builds.constants import LATEST +from readthedocs.builds.constants import LATEST from .indexes import ProjectIndex, PageIndex # Hack around django requiring a specific import path for signals >:x try: from readthedocs.search.signals import before_project_search, before_file_search except: - from search.signals import before_project_search, before_file_search + from readthedocs.search.signals import before_project_search, before_file_search def search_project(request, query, language): diff --git a/readthedocs/search/views.py b/readthedocs/search/views.py index 7db44c2cd71..513d4843356 100644 --- a/readthedocs/search/views.py +++ b/readthedocs/search/views.py @@ -19,12 +19,12 @@ from taggit.models import Tag import requests -from builds.constants import LATEST -from builds.filters import VersionSlugFilter -from builds.models import Version -from projects.models import Project, ImportedFile -from search.indexes import PageIndex -from search import lib as search_lib +from readthedocs.builds.constants import LATEST +from readthedocs.builds.filters import VersionSlugFilter +from readthedocs.builds.models import Version +from readthedocs.projects.models import Project, ImportedFile +from readthedocs.search.indexes import PageIndex +from readthedocs.search import lib as search_lib log = logging.getLogger(__name__) diff --git a/readthedocs/urls.py b/readthedocs/urls.py index 4075d93b32b..fb61c22282b 100644 --- a/readthedocs/urls.py +++ b/readthedocs/urls.py @@ -5,15 +5,15 @@ from tastypie.api import Api -from api.base import (ProjectResource, UserResource, BuildResource, +from readthedocs.api.base import (ProjectResource, UserResource, BuildResource, VersionResource, FileResource) -from builds.filters import VersionFilter -from builds.version_slug import VERSION_SLUG_REGEX -from core.views import HomepageView, SearchView -from projects.feeds import LatestProjectsFeed, NewProjectsFeed -from projects.filters import ProjectFilter -from projects.constants import LANGUAGES_REGEX -from projects.constants import PROJECT_SLUG_REGEX +from readthedocs.builds.filters import VersionFilter +from readthedocs.builds.version_slug import VERSION_SLUG_REGEX +from readthedocs.core.views import HomepageView, SearchView +from readthedocs.projects.feeds import LatestProjectsFeed, NewProjectsFeed +from readthedocs.projects.filters import ProjectFilter +from readthedocs.projects.constants import LANGUAGES_REGEX +from readthedocs.projects.constants import PROJECT_SLUG_REGEX v1_api = Api(api_name='v1') v1_api.register(BuildResource()) @@ -24,8 +24,8 @@ admin.autodiscover() -handler500 = 'core.views.server_error' -handler404 = 'core.views.server_error_404' +handler500 = 'readthedocs.core.views.server_error' +handler404 = 'readthedocs.core.views.server_error_404' pattern_opts = { @@ -45,76 +45,76 @@ url((r'^docs/(?P{project_slug})/(?P{lang_slug})/' r'(?P{version_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.serve_docs', + 'readthedocs.core.views.serve_docs', name='docs_detail'), # Redirect to default version, if only lang_slug is set. url((r'^docs/(?P{project_slug})/' r'(?P{lang_slug})/$'.format(**pattern_opts)), - 'core.views.redirect_lang_slug', + 'readthedocs.core.views.redirect_lang_slug', name='docs_detail'), # Redirect to default version, if only version_slug is set. url((r'^docs/(?P{project_slug})/' r'(?P{version_slug})/$'.format(**pattern_opts)), - 'core.views.redirect_version_slug', + 'readthedocs.core.views.redirect_version_slug', name='docs_detail'), # Redirect to default version. url(r'^docs/(?P{project_slug})/$'.format(**pattern_opts), - 'core.views.redirect_project_slug', + 'readthedocs.core.views.redirect_project_slug', name='docs_detail'), # Handle /page/ redirects for explicit "latest" version goodness. url((r'^docs/(?P{project_slug})/page/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.redirect_page_with_filename', + 'readthedocs.core.views.redirect_page_with_filename', name='docs_detail'), # Handle single version URLs url((r'^docs/(?P{project_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.serve_single_version_docs', + 'readthedocs.core.views.serve_single_version_docs', name='docs_detail'), # Handle fallbacks url((r'^user_builds/(?P{project_slug})/rtd-builds/' r'(?P{version_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.server_helpful_404', + 'readthedocs.core.views.server_helpful_404', name='user_buils_fallback'), url((r'^user_builds/(?P{project_slug})/translations/' r'(?P{lang_slug})/(?P{version_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.server_helpful_404', + 'readthedocs.core.views.server_helpful_404', name='user_builds_fallback_translations'), url(r'^i18n/', include('django.conf.urls.i18n')), - url(r'^projects/', include('projects.urls.public')), - url(r'^builds/', include('builds.urls')), - url(r'^bookmarks/', include('bookmarks.urls')), + url(r'^projects/', include('readthedocs.projects.urls.public')), + url(r'^builds/', include('readthedocs.builds.urls')), + url(r'^bookmarks/', include('readthedocs.bookmarks.urls')), # Ship elastic search - url(r'^search/$', 'search.views.elastic_search', name='search'), - url(r'^elasticsearch/$', 'search.views.elastic_search', name='elastic_search'), + url(r'^search/$', 'readthedocs.search.views.elastic_search', name='search'), + url(r'^elasticsearch/$', 'readthedocs.search.views.elastic_search', name='elastic_search'), url(r'^search/project/', SearchView.as_view(), name='haystack_project'), #url(r'^search/', include('haystack.urls')), url(r'^admin/', include(admin.site.urls)), - url(r'^dashboard/', include('projects.urls.private')), - url(r'^github', 'core.views.github_build', name='github_build'), - url(r'^bitbucket', 'core.views.bitbucket_build', name='bitbucket_build'), + url(r'^dashboard/', include('readthedocs.projects.urls.private')), + url(r'^github', 'readthedocs.core.views.github_build', name='github_build'), + url(r'^bitbucket', 'readthedocs.core.views.bitbucket_build', name='bitbucket_build'), url((r'^build/' r'(?P{project_slug})'.format(**pattern_opts)), - 'core.views.generic_build', + 'readthedocs.core.views.generic_build', name='generic_build'), url(r'^random/(?P{project_slug})'.format(**pattern_opts), - 'core.views.random_page', + 'readthedocs.core.views.random_page', name='random_page'), - url(r'^random/$', 'core.views.random_page', name='random_page'), - url(r'^sustainability/', include('donate.urls')), - url(r'^depth/$', 'core.views.queue_depth', name='queue_depth'), - url(r'^queue_info/$', 'core.views.queue_info', name='queue_info'), - url(r'^live/$', 'core.views.live_builds', name='live_builds'), - url(r'^500/$', 'core.views.divide_by_zero', name='divide_by_zero'), + url(r'^random/$', 'readthedocs.core.views.random_page', name='random_page'), + url(r'^sustainability/', include('readthedocs.donate.urls')), + url(r'^depth/$', 'readthedocs.core.views.queue_depth', name='queue_depth'), + url(r'^queue_info/$', 'readthedocs.core.views.queue_info', name='queue_info'), + url(r'^live/$', 'readthedocs.core.views.live_builds', name='live_builds'), + url(r'^500/$', 'readthedocs.core.views.divide_by_zero', name='divide_by_zero'), url(r'^filter/version/$', 'django_filters.views.object_filter', {'filter_class': VersionFilter, 'template_name': 'filter.html'}, @@ -125,17 +125,17 @@ name='filter_project'), url((r'^wipe/(?P{project_slug})/' r'(?P{version_slug})/$'.format(**pattern_opts)), - 'core.views.wipe_version', + 'readthedocs.core.views.wipe_version', name='wipe_version'), - url(r'^websupport/', include('comments.urls')), - url(r'^profiles/', include('profiles.urls.public')), - url(r'^accounts/', include('profiles.urls.private')), + url(r'^websupport/', include('readthedocs.comments.urls')), + url(r'^profiles/', include('readthedocs.profiles.urls.public')), + url(r'^accounts/', include('readthedocs.profiles.urls.private')), url(r'^accounts/', include('allauth.urls')), - url(r'^accounts/gold/', include('gold.urls')), + url(r'^accounts/gold/', include('readthedocs.gold.urls')), url(r'^api/', include(v1_api.urls)), - url(r'^api/v2/', include('restapi.urls')), + url(r'^api/v2/', include('readthedocs.restapi.urls')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^feeds/new/$', NewProjectsFeed(), @@ -145,7 +145,7 @@ name="latest_feed"), url((r'^mlt/(?P{project_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'core.views.morelikethis', + 'readthedocs.core.views.morelikethis', name='morelikethis'), ) diff --git a/readthedocs/vcs_support/backends/bzr.py b/readthedocs/vcs_support/backends/bzr.py index ccc28c17d11..654f4304e94 100644 --- a/readthedocs/vcs_support/backends/bzr.py +++ b/readthedocs/vcs_support/backends/bzr.py @@ -2,8 +2,8 @@ import re from StringIO import StringIO -from projects.exceptions import ProjectImportError -from vcs_support.base import BaseVCS, VCSVersion +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.vcs_support.base import BaseVCS, VCSVersion class Backend(BaseVCS): diff --git a/readthedocs/vcs_support/backends/git.py b/readthedocs/vcs_support/backends/git.py index a7de1866568..812f715c2fd 100644 --- a/readthedocs/vcs_support/backends/git.py +++ b/readthedocs/vcs_support/backends/git.py @@ -4,8 +4,8 @@ import os from StringIO import StringIO -from projects.exceptions import ProjectImportError -from vcs_support.base import BaseVCS, VCSVersion +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.vcs_support.base import BaseVCS, VCSVersion log = logging.getLogger(__name__) diff --git a/readthedocs/vcs_support/backends/hg.py b/readthedocs/vcs_support/backends/hg.py index ae49d1077a0..37bbdef6ad0 100644 --- a/readthedocs/vcs_support/backends/hg.py +++ b/readthedocs/vcs_support/backends/hg.py @@ -1,5 +1,5 @@ -from projects.exceptions import ProjectImportError -from vcs_support.base import BaseVCS, VCSVersion +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.vcs_support.base import BaseVCS, VCSVersion class Backend(BaseVCS): diff --git a/readthedocs/vcs_support/backends/launchpad.py b/readthedocs/vcs_support/backends/launchpad.py index dd2d8ab4335..cb8965a89f4 100644 --- a/readthedocs/vcs_support/backends/launchpad.py +++ b/readthedocs/vcs_support/backends/launchpad.py @@ -1,7 +1,7 @@ from launchpadlib.launchpad import Launchpad -from vcs_support.base import VCSVersion -from vcs_support.backends import bzr +from readthedocs.vcs_support.base import VCSVersion +from readthedocs.vcs_support.backends import bzr class Backend(bzr.Backend): diff --git a/readthedocs/vcs_support/backends/svn.py b/readthedocs/vcs_support/backends/svn.py index d1bea278fc3..7d87452f413 100644 --- a/readthedocs/vcs_support/backends/svn.py +++ b/readthedocs/vcs_support/backends/svn.py @@ -1,8 +1,8 @@ import csv from StringIO import StringIO -from projects.exceptions import ProjectImportError -from vcs_support.base import BaseVCS, VCSVersion +from readthedocs.projects.exceptions import ProjectImportError +from readthedocs.vcs_support.base import BaseVCS, VCSVersion class Backend(BaseVCS): diff --git a/readthedocs/vcs_support/test.py b/readthedocs/vcs_support/test.py index 6ad58d5a151..2309187f608 100644 --- a/readthedocs/vcs_support/test.py +++ b/readthedocs/vcs_support/test.py @@ -6,7 +6,7 @@ from django.conf import settings -from vcs_support import utils +from readthedocs.vcs_support import utils TEST_STATICS = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_statics') From 71f37708f7261048d9c28832e88c7021869db42b Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 17:12:24 -0700 Subject: [PATCH 10/12] Fix imports in tests/mocks --- readthedocs/rtd_tests/mocks/mock_api.py | 8 ++++---- readthedocs/rtd_tests/tests/test_builds.py | 14 +++++++------- .../rtd_tests/tests/test_core_management.py | 4 ++-- .../rtd_tests/tests/test_project_symlinks.py | 2 +- readthedocs/rtd_tests/tests/test_urls.py | 16 ++++++++-------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/readthedocs/rtd_tests/mocks/mock_api.py b/readthedocs/rtd_tests/mocks/mock_api.py index d91c5da8b21..240ad1d62fa 100644 --- a/readthedocs/rtd_tests/mocks/mock_api.py +++ b/readthedocs/rtd_tests/mocks/mock_api.py @@ -81,8 +81,8 @@ def project(self, x): def mock_api(repo): api_mock = MockApi(repo) with ( - mock.patch('restapi.client.api', api_mock) and - mock.patch('api.client.api', api_mock) and - mock.patch('projects.tasks.api_v2', api_mock) and - mock.patch('projects.tasks.api_v1', api_mock)): + mock.patch('readthedocs.restapi.client.api', api_mock) and + mock.patch('readthedocs.api.client.api', api_mock) and + mock.patch('readthedocs.projects.tasks.api_v2', api_mock) and + mock.patch('readthedocs.projects.tasks.api_v1', api_mock)): yield api_mock diff --git a/readthedocs/rtd_tests/tests/test_builds.py b/readthedocs/rtd_tests/tests/test_builds.py index 5db30652401..2fd08464fc0 100644 --- a/readthedocs/rtd_tests/tests/test_builds.py +++ b/readthedocs/rtd_tests/tests/test_builds.py @@ -34,7 +34,7 @@ class BuildTests(TestCase): @mock.patch('slumber.Resource') @mock.patch('os.chdir') - @mock.patch('projects.models.Project.api_versions') + @mock.patch('readthedocs.projects.models.Project.api_versions') @mock.patch('subprocess.Popen') def test_build(self, mock_Popen, mock_api_versions, mock_chdir, mock_apiv2_downloads): @@ -95,9 +95,9 @@ def test_builder_no_comments(self): @mock.patch('slumber.Resource') @mock.patch('os.chdir') @mock.patch('subprocess.Popen') - @mock.patch('doc_builder.backends.sphinx.HtmlBuilder.build') - @mock.patch('doc_builder.backends.sphinx.PdfBuilder.build') - @mock.patch('doc_builder.backends.sphinx.EpubBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.HtmlBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.PdfBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.EpubBuilder.build') def test_build_respects_pdf_flag(self, EpubBuilder_build, PdfBuilder_build, @@ -139,9 +139,9 @@ def test_build_respects_pdf_flag(self, @mock.patch('slumber.Resource') @mock.patch('os.chdir') @mock.patch('subprocess.Popen') - @mock.patch('doc_builder.backends.sphinx.HtmlBuilder.build') - @mock.patch('doc_builder.backends.sphinx.PdfBuilder.build') - @mock.patch('doc_builder.backends.sphinx.EpubBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.HtmlBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.PdfBuilder.build') + @mock.patch('readthedocs.doc_builder.backends.sphinx.EpubBuilder.build') def test_build_respects_epub_flag(self, EpubBuilder_build, PdfBuilder_build, diff --git a/readthedocs/rtd_tests/tests/test_core_management.py b/readthedocs/rtd_tests/tests/test_core_management.py index 7e498eb6a96..4f4cb6c75b2 100644 --- a/readthedocs/rtd_tests/tests/test_core_management.py +++ b/readthedocs/rtd_tests/tests/test_core_management.py @@ -40,7 +40,7 @@ def _input(_, files=None): assert cmd._get_input() == '{"test": "foobar"}' @patch.object(run_docker.Command, '_get_input', _get_input) - @patch('projects.tasks.docker_build', _docker_build) + .patch('readthedocs.projects.tasks.docker_build', _docker_build) @patch('sys.stdout', new_callable=StringIO) def test_good_input(self, mock_output): '''Test docker build command''' @@ -52,7 +52,7 @@ def test_good_input(self, mock_output): '{"html": [0, "DOCKER PASS", ""]}\n' ) - @patch('projects.tasks.docker_build', _docker_build) + .patch('readthedocs.projects.tasks.docker_build', _docker_build) def test_bad_input(self): '''Test docker build command''' with patch.object(run_docker.Command, '_get_input') as mock_input: diff --git a/readthedocs/rtd_tests/tests/test_project_symlinks.py b/readthedocs/rtd_tests/tests/test_project_symlinks.py index 6e226be44de..38a7ceb0c12 100644 --- a/readthedocs/rtd_tests/tests/test_project_symlinks.py +++ b/readthedocs/rtd_tests/tests/test_project_symlinks.py @@ -18,7 +18,7 @@ def wrapper(self): def _collect_commands(cmd): self.commands.append(cmd) - with patch('projects.symlinks.run_on_app_servers', _collect_commands): + with.patch('readthedocs.projects.symlinks.run_on_app_servers', _collect_commands): with patch('readthedocs.projects.symlinks.run_on_app_servers', _collect_commands): return fn(self) return wrapper diff --git a/readthedocs/rtd_tests/tests/test_urls.py b/readthedocs/rtd_tests/tests/test_urls.py index 87fb08515da..1be2576d861 100644 --- a/readthedocs/rtd_tests/tests/test_urls.py +++ b/readthedocs/rtd_tests/tests/test_urls.py @@ -9,47 +9,47 @@ class SubdomainUrlTests(TestCase): def test_sub_index(self): url = reverse(core.views.redirect_project_slug, - urlconf='core.subdomain_urls') + urlconf='readthedocs.core.subdomain_urls') self.assertEqual(url, '/') def test_sub_lang_version(self): - url = reverse('docs_detail', urlconf='core.subdomain_urls', + url = reverse('docs_detail', urlconf='readthedocs.core.subdomain_urls', kwargs={'lang_slug': 'en', 'version_slug': LATEST}) self.assertEqual(url, '/en/latest/') def test_sub_lang_version_filename(self): - url = reverse('docs_detail', urlconf='core.subdomain_urls', + url = reverse('docs_detail', urlconf='readthedocs.core.subdomain_urls', args=['en', 'latest', 'index.html']) self.assertEqual(url, '/en/latest/index.html') def test_sub_project_full_path(self): url = reverse('subproject_docs_detail', - urlconf='core.subdomain_urls', + urlconf='readthedocs.core.subdomain_urls', kwargs={'project_slug':'pyramid', 'lang_slug': 'en', 'version_slug': LATEST, 'filename': 'index.html'}) self.assertEqual(url, '/projects/pyramid/en/latest/index.html') def test_sub_project_slug_only(self): url = reverse('subproject_docs_detail', - urlconf='core.subdomain_urls', + urlconf='readthedocs.core.subdomain_urls', kwargs={'project_slug': 'pyramid'}) self.assertEqual(url, '/projects/pyramid') def test_sub_page(self): url = reverse('docs_detail', - urlconf='core.subdomain_urls', + urlconf='readthedocs.core.subdomain_urls', kwargs={'filename': 'install.html'}) self.assertEqual(url, '/page/install.html') def test_sub_version(self): url = reverse('version_subdomain_handler', - urlconf='core.subdomain_urls', + urlconf='readthedocs.core.subdomain_urls', kwargs={'version_slug': '1.4.1'}) self.assertEqual(url, '/1.4.1/') def test_sub_lang(self): url = reverse('lang_subdomain_handler', - urlconf='core.subdomain_urls', + urlconf='readthedocs.core.subdomain_urls', kwargs={'lang_slug': 'en'}) self.assertEqual(url, '/en/') From b8ceb5576ddce05b864d5b58fddeafa977ef74dc Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 28 Jul 2015 17:16:25 -0700 Subject: [PATCH 11/12] Small human cleanup of test cases --- readthedocs/rtd_tests/tests/test_core_management.py | 4 ++-- readthedocs/rtd_tests/tests/test_project_symlinks.py | 2 +- readthedocs/rtd_tests/tests/test_urls.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/readthedocs/rtd_tests/tests/test_core_management.py b/readthedocs/rtd_tests/tests/test_core_management.py index 4f4cb6c75b2..8a572e7ba36 100644 --- a/readthedocs/rtd_tests/tests/test_core_management.py +++ b/readthedocs/rtd_tests/tests/test_core_management.py @@ -40,7 +40,7 @@ def _input(_, files=None): assert cmd._get_input() == '{"test": "foobar"}' @patch.object(run_docker.Command, '_get_input', _get_input) - .patch('readthedocs.projects.tasks.docker_build', _docker_build) + @patch('readthedocs.projects.tasks.docker_build', _docker_build) @patch('sys.stdout', new_callable=StringIO) def test_good_input(self, mock_output): '''Test docker build command''' @@ -52,7 +52,7 @@ def test_good_input(self, mock_output): '{"html": [0, "DOCKER PASS", ""]}\n' ) - .patch('readthedocs.projects.tasks.docker_build', _docker_build) + @patch('readthedocs.projects.tasks.docker_build', _docker_build) def test_bad_input(self): '''Test docker build command''' with patch.object(run_docker.Command, '_get_input') as mock_input: diff --git a/readthedocs/rtd_tests/tests/test_project_symlinks.py b/readthedocs/rtd_tests/tests/test_project_symlinks.py index 38a7ceb0c12..2227c836db4 100644 --- a/readthedocs/rtd_tests/tests/test_project_symlinks.py +++ b/readthedocs/rtd_tests/tests/test_project_symlinks.py @@ -18,7 +18,7 @@ def wrapper(self): def _collect_commands(cmd): self.commands.append(cmd) - with.patch('readthedocs.projects.symlinks.run_on_app_servers', _collect_commands): + with patch('readthedocs.projects.symlinks.run_on_app_servers', _collect_commands): with patch('readthedocs.projects.symlinks.run_on_app_servers', _collect_commands): return fn(self) return wrapper diff --git a/readthedocs/rtd_tests/tests/test_urls.py b/readthedocs/rtd_tests/tests/test_urls.py index 1be2576d861..995f994fe63 100644 --- a/readthedocs/rtd_tests/tests/test_urls.py +++ b/readthedocs/rtd_tests/tests/test_urls.py @@ -8,7 +8,7 @@ class SubdomainUrlTests(TestCase): def test_sub_index(self): - url = reverse(core.views.redirect_project_slug, + url = reverse(readthedocs.core.views.redirect_project_slug, urlconf='readthedocs.core.subdomain_urls') self.assertEqual(url, '/') From 7cbc3dd5629f561e80118b389d26b7d9521bfd9f Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 30 Jul 2015 11:23:22 -0700 Subject: [PATCH 12/12] Fix apiv1 --- readthedocs/api/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readthedocs/api/base.py b/readthedocs/api/base.py index 099dfeeea05..e2a47daf9ac 100644 --- a/readthedocs/api/base.py +++ b/readthedocs/api/base.py @@ -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 @@ -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