Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rtfd/readthedocs.org into humitos…
Browse files Browse the repository at this point in the history
…/git/unicode-branches
  • Loading branch information
ericholscher committed Nov 6, 2018
2 parents 5c5ea15 + d2137df commit 9f0e3f9
Show file tree
Hide file tree
Showing 33 changed files with 635 additions and 261 deletions.
6 changes: 6 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
formats: all
sphinx:
configuration: docs/conf.py
python:
requirements: requirements.txt
58 changes: 58 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
Version 2.8.1
-------------

:Date: November 06, 2018

* `@ericholscher <http://github.com/ericholscher>`__: Fix migration name on modified date migration (`#4867 <https://github.com/rtfd/readthedocs.org/pull/4867>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Change 'VerisionLockedTimeout' to 'VersionLockedError' in comment. (`#4859 <https://github.com/rtfd/readthedocs.org/pull/4859>`__)
* `@stsewd <http://github.com/stsewd>`__: Fix rtd config file (`#4857 <https://github.com/rtfd/readthedocs.org/pull/4857>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Shorten project name to match slug length (`#4856 <https://github.com/rtfd/readthedocs.org/pull/4856>`__)
* `@stsewd <http://github.com/stsewd>`__: Generic message for parser error of config file (`#4853 <https://github.com/rtfd/readthedocs.org/pull/4853>`__)
* `@stsewd <http://github.com/stsewd>`__: Use $HOME as CWD for virtualenv creation (`#4852 <https://github.com/rtfd/readthedocs.org/pull/4852>`__)
* `@stsewd <http://github.com/stsewd>`__: Hide "edit on" when the version is a tag (`#4851 <https://github.com/rtfd/readthedocs.org/pull/4851>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Add modified_date to ImportedFile. (`#4850 <https://github.com/rtfd/readthedocs.org/pull/4850>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Use raw_id_fields so that the Feature admin loads (`#4849 <https://github.com/rtfd/readthedocs.org/pull/4849>`__)
* `@stsewd <http://github.com/stsewd>`__: Allow to change project's VCS (`#4845 <https://github.com/rtfd/readthedocs.org/pull/4845>`__)
* `@benjaoming <http://github.com/benjaoming>`__: Version compare warning text (`#4842 <https://github.com/rtfd/readthedocs.org/pull/4842>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Make form for adopting project a choice field (`#4841 <https://github.com/rtfd/readthedocs.org/pull/4841>`__)
* `@humitos <http://github.com/humitos>`__: Do not send notification on VersionLockedError (`#4839 <https://github.com/rtfd/readthedocs.org/pull/4839>`__)
* `@stsewd <http://github.com/stsewd>`__: Start testing config v2 on our project (`#4838 <https://github.com/rtfd/readthedocs.org/pull/4838>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Add all migrations that are missing from model changes (`#4837 <https://github.com/rtfd/readthedocs.org/pull/4837>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Add docstring to DrfJsonSerializer so we know why it's there (`#4836 <https://github.com/rtfd/readthedocs.org/pull/4836>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Show the project's slug in the dashboard (`#4834 <https://github.com/rtfd/readthedocs.org/pull/4834>`__)
* `@humitos <http://github.com/humitos>`__: Avoid infinite redirection (`#4833 <https://github.com/rtfd/readthedocs.org/pull/4833>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Allow filtering builds by commit. (`#4831 <https://github.com/rtfd/readthedocs.org/pull/4831>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Add 'Branding' under the 'Business Info' section and 'Guidelines' on 'Design Docs' (`#4830 <https://github.com/rtfd/readthedocs.org/pull/4830>`__)
* `@davidfischer <http://github.com/davidfischer>`__: Migrate old passwords without "set_unusable_password" (`#4829 <https://github.com/rtfd/readthedocs.org/pull/4829>`__)
* `@humitos <http://github.com/humitos>`__: Do not import the Celery worker when running the Django app (`#4824 <https://github.com/rtfd/readthedocs.org/pull/4824>`__)
* `@damianz5 <http://github.com/damianz5>`__: Fix for jQuery in doc-embed call (`#4819 <https://github.com/rtfd/readthedocs.org/pull/4819>`__)
* `@invinciblycool <http://github.com/invinciblycool>`__: Add MkDocsYAMLParseError (`#4814 <https://github.com/rtfd/readthedocs.org/pull/4814>`__)
* `@stsewd <http://github.com/stsewd>`__: Delete untracked tags on fetch (`#4811 <https://github.com/rtfd/readthedocs.org/pull/4811>`__)
* `@stsewd <http://github.com/stsewd>`__: Don't activate version on build (`#4810 <https://github.com/rtfd/readthedocs.org/pull/4810>`__)
* `@humitos <http://github.com/humitos>`__: Feature flag to make `readthedocs` theme default on MkDocs docs (`#4802 <https://github.com/rtfd/readthedocs.org/pull/4802>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Allow use of `file://` urls in repos during development. (`#4801 <https://github.com/rtfd/readthedocs.org/pull/4801>`__)
* `@ericholscher <http://github.com/ericholscher>`__: Release 2.7.2 (`#4796 <https://github.com/rtfd/readthedocs.org/pull/4796>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Raise 404 at SubdomainMiddleware if the project does not exist. (`#4795 <https://github.com/rtfd/readthedocs.org/pull/4795>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Add help_text in the form for adopting a project (`#4781 <https://github.com/rtfd/readthedocs.org/pull/4781>`__)
* `@humitos <http://github.com/humitos>`__: Add VAT ID field for Gold User (`#4776 <https://github.com/rtfd/readthedocs.org/pull/4776>`__)
* `@sriks123 <http://github.com/sriks123>`__: Remove logic around finding config file inside directories (`#4755 <https://github.com/rtfd/readthedocs.org/pull/4755>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Improve unexpected error message when build fails (`#4754 <https://github.com/rtfd/readthedocs.org/pull/4754>`__)
* `@stsewd <http://github.com/stsewd>`__: Don't build latest on webhook if it is deactivated (`#4733 <https://github.com/rtfd/readthedocs.org/pull/4733>`__)
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Change the way of using login_required decorator (`#4723 <https://github.com/rtfd/readthedocs.org/pull/4723>`__)
* `@invinciblycool <http://github.com/invinciblycool>`__: Remove unused views and their translations. (`#4632 <https://github.com/rtfd/readthedocs.org/pull/4632>`__)
* `@invinciblycool <http://github.com/invinciblycool>`__: Redirect to build detail post manual build (`#4622 <https://github.com/rtfd/readthedocs.org/pull/4622>`__)
* `@anubhavsinha98 <http://github.com/anubhavsinha98>`__: Issue #4551 Changed mock docks to use sphinx (`#4569 <https://github.com/rtfd/readthedocs.org/pull/4569>`__)
* `@xrmx <http://github.com/xrmx>`__: search: mark more strings for translation (`#4438 <https://github.com/rtfd/readthedocs.org/pull/4438>`__)
* `@Alig1493 <http://github.com/Alig1493>`__: Fix for issue #4092: Remove unused field from Project model (`#4431 <https://github.com/rtfd/readthedocs.org/pull/4431>`__)
* `@mashrikt <http://github.com/mashrikt>`__: Remove pytest _describe (`#4429 <https://github.com/rtfd/readthedocs.org/pull/4429>`__)
* `@xrmx <http://github.com/xrmx>`__: static: use modern getJSON callbacks (`#4382 <https://github.com/rtfd/readthedocs.org/pull/4382>`__)
* `@jaraco <http://github.com/jaraco>`__: Script for creating a project (`#4370 <https://github.com/rtfd/readthedocs.org/pull/4370>`__)
* `@xrmx <http://github.com/xrmx>`__: make it easier to use a different default theme (`#4278 <https://github.com/rtfd/readthedocs.org/pull/4278>`__)
* `@humitos <http://github.com/humitos>`__: Document alternate domains for business site (`#4271 <https://github.com/rtfd/readthedocs.org/pull/4271>`__)
* `@xrmx <http://github.com/xrmx>`__: restapi/client: don't use DRF parser for parsing (`#4160 <https://github.com/rtfd/readthedocs.org/pull/4160>`__)
* `@julienmalard <http://github.com/julienmalard>`__: New languages (`#3759 <https://github.com/rtfd/readthedocs.org/pull/3759>`__)
* `@stsewd <http://github.com/stsewd>`__: Improve installation guide (`#3631 <https://github.com/rtfd/readthedocs.org/pull/3631>`__)
* `@stsewd <http://github.com/stsewd>`__: Allow to hide version warning (`#3595 <https://github.com/rtfd/readthedocs.org/pull/3595>`__)
* `@Alig1493 <http://github.com/Alig1493>`__: [Fixed #872] Filter Builds according to commit (`#3544 <https://github.com/rtfd/readthedocs.org/pull/3544>`__)
* `@stsewd <http://github.com/stsewd>`__: Make slug field a valid DNS label (`#3464 <https://github.com/rtfd/readthedocs.org/pull/3464>`__)

Version 2.8.0
-------------

Expand Down
39 changes: 31 additions & 8 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,55 @@
"""Models for the builds app."""

from __future__ import (
absolute_import, division, print_function, unicode_literals)
absolute_import,
division,
print_function,
unicode_literals,
)

import logging
import os.path
import re
from builtins import object
from shutil import rmtree

from builtins import object
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from guardian.shortcuts import assign
from taggit.managers import TaggableManager

from readthedocs.core.utils import broadcast
from readthedocs.projects.constants import (
BITBUCKET_URL, GITHUB_URL, GITLAB_URL, PRIVACY_CHOICES, PRIVATE)
BITBUCKET_URL,
GITHUB_URL,
GITLAB_URL,
PRIVACY_CHOICES,
PRIVATE,
)
from readthedocs.projects.models import APIProject, Project

from .constants import (
BRANCH, BUILD_STATE, BUILD_STATE_FINISHED, BUILD_TYPES, LATEST,
NON_REPOSITORY_VERSIONS, STABLE, TAG, VERSION_TYPES)
BRANCH,
BUILD_STATE,
BUILD_STATE_FINISHED,
BUILD_TYPES,
LATEST,
NON_REPOSITORY_VERSIONS,
STABLE,
TAG,
VERSION_TYPES,
)
from .managers import VersionManager
from .querysets import BuildQuerySet, RelatedBuildQuerySet, VersionQuerySet
from .utils import (
get_bitbucket_username_repo, get_github_username_repo,
get_gitlab_username_repo)
get_bitbucket_username_repo,
get_github_username_repo,
get_gitlab_username_repo,
)
from .version_slug import VersionSlugField

DEFAULT_VERSION_PRIVACY_LEVEL = getattr(
Expand Down Expand Up @@ -193,6 +212,10 @@ def identifier_friendly(self):
return self.identifier[:8]
return self.identifier

@property
def is_editable(self):
return self.type == BRANCH

def get_subdomain_url(self):
private = self.privacy_level == PRIVATE
return self.project.get_docs_url(
Expand Down
51 changes: 35 additions & 16 deletions readthedocs/builds/views.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# -*- coding: utf-8 -*-

"""Views for builds app."""

from __future__ import absolute_import
from builtins import object
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)

import logging

from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
from builtins import object
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import (
HttpResponseForbidden,
HttpResponsePermanentRedirect,
HttpResponseRedirect,
)
from django.contrib.auth.decorators import login_required
from readthedocs.core.permissions import AdminPermission
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django.views.generic import DetailView, ListView

from readthedocs.builds.models import Build, Version
from readthedocs.core.permissions import AdminPermission
from readthedocs.core.utils import trigger_build
from readthedocs.projects.models import Project


log = logging.getLogger(__name__)


Expand All @@ -31,9 +38,11 @@ def get_queryset(self):
self.project_slug = self.kwargs.get('project_slug', None)
self.project = get_object_or_404(
Project.objects.protected(self.request.user),
slug=self.project_slug
slug=self.project_slug,
)
queryset = Build.objects.public(
user=self.request.user, project=self.project
)
queryset = Build.objects.public(user=self.request.user, project=self.project)

return queryset

Expand All @@ -54,20 +63,25 @@ def post(self, request, project_slug):
slug=version_slug,
)

trigger_build(project=project, version=version)
return HttpResponseRedirect(reverse('builds_project_list', args=[project.slug]))
_, build = trigger_build(project=project, version=version)
return HttpResponseRedirect(
reverse('builds_detail', args=[project.slug, build.pk]),
)


class BuildList(BuildBase, BuildTriggerMixin, ListView):

def get_context_data(self, **kwargs):
context = super(BuildList, self).get_context_data(**kwargs)

active_builds = self.get_queryset().exclude(state="finished").values('id')
active_builds = self.get_queryset().exclude(state='finished'
).values('id')

context['project'] = self.project
context['active_builds'] = active_builds
context['versions'] = Version.objects.public(user=self.request.user, project=self.project)
context['versions'] = Version.objects.public(
user=self.request.user, project=self.project
)
context['build_qs'] = self.get_queryset()

return context
Expand All @@ -84,9 +98,14 @@ def get_context_data(self, **kwargs):

# Old build view redirects


def builds_redirect_list(request, project_slug): # pylint: disable=unused-argument
return HttpResponsePermanentRedirect(reverse('builds_project_list', args=[project_slug]))
return HttpResponsePermanentRedirect(
reverse('builds_project_list', args=[project_slug])
)


def builds_redirect_detail(request, project_slug, pk): # pylint: disable=unused-argument
return HttpResponsePermanentRedirect(reverse('builds_detail', args=[project_slug, pk]))
return HttpResponsePermanentRedirect(
reverse('builds_detail', args=[project_slug, pk])
)
5 changes: 3 additions & 2 deletions readthedocs/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Django admin interface for core models."""

from __future__ import absolute_import
from datetime import datetime, timedelta
from datetime import timedelta

from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone

from readthedocs.core.models import UserProfile
from readthedocs.projects.models import Project
Expand Down Expand Up @@ -50,7 +51,7 @@ def queryset(self, request, queryset):
if self.value() == self.PROJECT_BUILT:
return queryset.filter(projects__versions__built=True)
if self.value() == self.PROJECT_RECENT:
recent_date = datetime.today() - timedelta(days=365)
recent_date = timezone.now() - timedelta(days=365)
return queryset.filter(projects__builds__date__gt=recent_date)


Expand Down
12 changes: 6 additions & 6 deletions readthedocs/core/fixtures/eric.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"is_active": true,
"is_superuser": false,
"is_staff": true,
"last_login": "2010-08-14 01:51:05",
"last_login": "2010-08-14T01:51:05+00:00",
"groups": [],
"user_permissions": [],
"password": "pbkdf2_sha256$30000$Vs87OlKZEzCb$nUw1o5pGQw7ff/QhnleSpUOupBaT1DogZrVaoZyQRyc=",
"email": "e@e.co",
"date_joined": "2010-08-14 01:50:58"
"date_joined": "2010-08-14T01:50:58+00:00"
}
},
{
Expand All @@ -27,12 +27,12 @@
"is_active": true,
"is_superuser": false,
"is_staff": true,
"last_login": "2010-08-14 01:51:05",
"last_login": "2010-08-14T01:51:05+00:00",
"groups": [],
"user_permissions": [],
"password": "pbkdf2_sha256$30000$Vs87OlKZEzCb$nUw1o5pGQw7ff/QhnleSpUOupBaT1DogZrVaoZyQRyc=",
"email": "e@etest.co",
"date_joined": "2010-08-14 01:50:58"
"date_joined": "2010-08-14T01:50:58+00:00"
}
},
{
Expand All @@ -45,12 +45,12 @@
"is_active": true,
"is_superuser": true,
"is_staff": true,
"last_login": "2010-08-14 01:51:05",
"last_login": "2010-08-14T01:51:05+00:00",
"groups": [],
"user_permissions": [],
"password": "pbkdf2_sha256$30000$Vs87OlKZEzCb$nUw1o5pGQw7ff/QhnleSpUOupBaT1DogZrVaoZyQRyc=",
"email": "e@e.co",
"date_joined": "2010-08-14 01:50:58"
"date_joined": "2010-08-14T01:50:58+00:00"
}
}
]
5 changes: 3 additions & 2 deletions readthedocs/core/management/commands/clean_builds.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Clean up stable build paths per project version"""

from __future__ import absolute_import
from datetime import datetime, timedelta
from datetime import timedelta
import logging
from optparse import make_option

from django.core.management.base import BaseCommand
from django.db.models import Max
from django.utils import timezone

from readthedocs.builds.models import Build, Version

Expand Down Expand Up @@ -35,7 +36,7 @@ def add_arguments(self, parser):

def handle(self, *args, **options):
"""Find stale builds and remove build paths"""
max_date = datetime.now() - timedelta(days=options['days'])
max_date = timezone.now() - timedelta(days=options['days'])
queryset = (Build.objects
.values('project', 'version')
.annotate(max_date=Max('date'))
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/static/core/js/readthedocs-doc-embed.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9f0e3f9

Please sign in to comment.