Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Clean up imports #358

Merged
merged 1 commit into from

2 participants

@wraithan
Collaborator

remove stale ones, add missing ones, etc.

@ericholscher ericholscher merged commit 6fbedbb into rtfd:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2013
  1. @wraithan

    clean up imports

    wraithan authored
This page is out of date. Refresh to see the latest.
View
9 fabfile.py
@@ -60,15 +60,6 @@ def restart():
@hosts(['chimera.readthedocs.com', 'asgard.readthedocs.com'])
def reload():
- "Restart (or just start) the server"
- env.user = "docs"
- pid = run("ps aux |grep gunicorn |grep master |awk '{ print $2 }'")
- run('kill -HUP %s' % pid)
- #so it has time to reload
- time.sleep(3)
-
-@hosts(['chimera.readthedocs.com', 'asgard.readthedocs.com'])
-def reload():
"Reload (or just start) the server"
run("supervisorctl update")
View
12 readthedocs/api/base.py
@@ -1,26 +1,16 @@
import logging
-from django.core.paginator import Paginator, InvalidPage
from django.contrib.auth.models import User
from django.conf.urls.defaults import url
from django.shortcuts import get_object_or_404
-from django.http import Http404
-from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext
-from haystack.utils import Highlighter
from tastypie import fields
-from tastypie.authentication import BasicAuthentication
-from tastypie.authorization import Authorization, DjangoAuthorization
+from tastypie.authorization import DjangoAuthorization
from tastypie.constants import ALL_WITH_RELATIONS, ALL
from tastypie.resources import ModelResource
-from tastypie.exceptions import NotFound, ImmediateHttpResponse
-from tastypie import http
-from tastypie.utils.mime import build_content_type
from tastypie.http import HttpCreated
from tastypie.utils import dict_strip_unicode_keys, trailing_slash
-from core.forms import FacetedSearchForm
from builds.models import Build, Version
from projects.models import Project, ImportedFile
from projects.utils import highest_version, mkversion
View
14 readthedocs/api/utils.py
@@ -1,31 +1,19 @@
import logging
from django.core.paginator import Paginator, InvalidPage
-from django.contrib.auth.models import User
-from django.conf.urls.defaults import url
-from django.shortcuts import get_object_or_404
from django.http import Http404
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext
from haystack.utils import Highlighter
-from tastypie import fields
from tastypie.authentication import BasicAuthentication
-from tastypie.authorization import Authorization, DjangoAuthorization
-from tastypie.constants import ALL_WITH_RELATIONS, ALL
+from tastypie.authorization import Authorization
from tastypie.resources import ModelResource
from tastypie.exceptions import NotFound, ImmediateHttpResponse
from tastypie import http
from tastypie.utils.mime import build_content_type
-from tastypie.http import HttpCreated
-from tastypie.utils import dict_strip_unicode_keys, trailing_slash
from core.forms import FacetedSearchForm
-from builds.models import Build, Version
-from projects.models import Project, ImportedFile
-from projects.utils import highest_version, mkversion
-from projects import tasks
-from djangome import views as djangome
log = logging.getLogger(__name__)
View
3  readthedocs/builds/views.py
@@ -1,9 +1,6 @@
-from django.core.urlresolvers import reverse
-from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list, object_detail
-from guardian.decorators import permission_required_or_403
from taggit.models import Tag
from builds.models import Build
View
1  readthedocs/core/management/commands/build_files.py
@@ -6,7 +6,6 @@
from projects import tasks
-from projects.models import ImportedFile
from builds.models import Version
log = logging.getLogger(__name__)
View
2  readthedocs/core/middleware.py
@@ -2,8 +2,6 @@
from django.conf import settings
from django.core.cache import cache
from django.http import Http404
-from django.http import HttpResponsePermanentRedirect
-from django.utils.http import urlquote
import redis
View
7 readthedocs/core/views.py
@@ -2,11 +2,11 @@
documentation and header rendering, and server errors.
"""
-from django.core.urlresolvers import reverse
+from django.core.urlresolvers import NoReverseMatch, reverse
from django.conf import settings
from django.contrib.auth.models import User
-from django.http import HttpResponse, HttpResponseRedirect, \
- HttpResponsePermanentRedirect, Http404, HttpResponseNotFound
+from django.http import (HttpResponse, HttpResponseRedirect, Http404,
+ HttpResponseNotFound)
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from django.views.decorators.csrf import csrf_view_exempt
@@ -15,7 +15,6 @@
from haystack.query import EmptySearchQuerySet
from haystack.query import SearchQuerySet
-from guardian.shortcuts import get_objects_for_user
from builds.models import Build
from builds.models import Version
View
1  readthedocs/doc_builder/backends/sphinx.py
@@ -161,7 +161,6 @@ def clean(self, **kwargs):
@restoring_chdir
def build(self, **kwargs):
- id_dir = "/tmp/"
project = self.version.project
os.chdir(project.conf_dir(self.version.slug))
force_str = " -E " if self.force else ""
View
6 readthedocs/projects/forms.py
@@ -7,7 +7,7 @@
from django.utils.safestring import mark_safe
from projects import constants
-from projects.models import Project, EmailHook, WebHook
+from projects.models import Project, EmailHook
from projects.tasks import update_docs
@@ -218,7 +218,7 @@ def clean_user(self):
return name
def save(self):
- project = self.project.users.add(self.user)
+ self.project.users.add(self.user)
return self.user
class EmailHookForm(forms.Form):
@@ -233,7 +233,7 @@ def clean_email(self):
return self.email
def save(self):
- project = self.project.emailhook_notifications.add(self.email)
+ self.project.emailhook_notifications.add(self.email)
return self.project
class TranslationForm(forms.Form):
View
5 readthedocs/projects/models.py
@@ -9,12 +9,12 @@
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
-from guardian.shortcuts import assign, get_objects_for_user, get_perms
+from guardian.shortcuts import assign, get_objects_for_user
from projects import constants
from projects.exceptions import ProjectImportError
from projects.templatetags.projects_tags import sort_version_aware
-from projects.utils import highest_version as _highest, make_api_version, make_api_project
+from projects.utils import highest_version as _highest, make_api_version
from taggit.managers import TaggableManager
from tastyapi.slum import api
@@ -485,7 +485,6 @@ def get_latest_build(self):
return None
def api_versions(self):
- from builds.models import Version
ret = []
for version_data in api.version.get(project=self.pk, active=True)['objects']:
version = make_api_version(version_data)
View
26 readthedocs/projects/tasks.py
@@ -9,28 +9,26 @@
import logging
import operator
-from celery.decorators import task, periodic_task
-from celery.task.schedules import crontab
-from django.db import transaction
+from celery.decorators import task
from django.conf import settings
+from django.contrib.sites.models import Site
+from django.core.mail import send_mail
+from django.db import transaction
+from django.template import Context
+from django.template.loader import get_template
+from django.utils.translation import ugettext_lazy as _
import redis
-from sphinx.ext import intersphinx
+import requests
import slumber
+from sphinx.ext import intersphinx
-
-from builds.models import Version
+from builds.models import Build, Version
from doc_builder import loading as builder_loading
from doc_builder.base import restoring_chdir
from projects.exceptions import ProjectImportError
from projects.models import ImportedFile, Project
-from projects.utils import (
- mkversion,
- purge_version,
- run,
- slugify_uniquely,
- make_api_version,
- make_api_project,
- )
+from projects.utils import (mkversion, purge_version, run, slugify_uniquely,
+ make_api_version, make_api_project)
from tastyapi import client as tastyapi_client
from tastyapi import api
from core.utils import copy_to_app_servers, run_on_app_servers
View
4 readthedocs/projects/utils.py
@@ -142,11 +142,11 @@ def purge_version(version, mainsite=False, subdomain=False, cname=False):
url = "/docs/%s/en/%s/*" % (version.project.slug, version.slug)
to_purge = "http://%s%s" % (server, url)
log.info("Purging %s on readthedocs.org" % url)
- ret = h.request(to_purge, method="PURGE", headers=headers)
+ h.request(to_purge, method="PURGE", headers=headers)
root_url = "/docs/%s/" % version.project.slug
to_purge = "http://%s%s" % (server, root_url)
log.info("Purging %s on readthedocs.org" % root_url)
- ret2 = h.request(to_purge, method="PURGE", headers=headers)
+ h.request(to_purge, method="PURGE", headers=headers)
if cname:
redis_conn = redis.Redis(**settings.REDIS)
for cnamed in redis_conn.smembers('rtd_slug:v1:%s' % version.project.slug):
View
2  readthedocs/projects/views/private.py
@@ -19,7 +19,7 @@
from projects.forms import (ImportProjectForm, build_versions_form,
build_upload_html_form, SubprojectForm,
UserForm, EmailHookForm, TranslationForm)
-from projects.models import Project, EmailHook, WebHook
+from projects.models import Project, EmailHook
from projects.tasks import unzip_files
from projects import constants
View
13 readthedocs/projects/views/public.py
@@ -1,21 +1,16 @@
import json
from django.contrib.auth.models import User
-from django.core.urlresolvers import reverse, NoReverseMatch
-from django.http import (HttpResponse, HttpResponseRedirect,
- Http404, HttpResponsePermanentRedirect)
+from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.views.generic.list_detail import object_list
from django.utils.datastructures import SortedDict
-from guardian.decorators import permission_required_or_403
-from guardian.shortcuts import get_objects_for_user
from taggit.models import Tag
from builds.filters import VersionSlugFilter
from builds.models import Version
-from core.views import serve_docs
from projects.models import Project
from projects.utils import highest_version
@@ -157,7 +152,7 @@ def version_autocomplete(request, project_slug):
version_queryset = versions.filter(slug__icontains=term)[:20]
names = version_queryset.values_list('slug', flat=True)
- json_response = simplejson.dumps(list(names))
+ json_response = json.dumps(list(names))
return HttpResponse(json_response, mimetype='text/javascript')
@@ -167,10 +162,10 @@ def version_filter_autocomplete(request, project_slug):
versions = Version.objects.public(request.user)
filter = VersionSlugFilter(request.GET, queryset=versions)
format = request.GET.get('format', 'json')
-
+
if format == 'json':
names = filter.qs.values_list('slug', flat=True)
- json_response = simplejson.dumps(list(names))
+ json_response = json.dumps(list(names))
return HttpResponse(json_response, mimetype='text/javascript')
elif format == 'html':
return render_to_response(
View
1  setup.py
@@ -1,4 +1,3 @@
-import os
from setuptools import setup, find_packages
Something went wrong with that request. Please try again.