Skip to content

Commit

Permalink
update hook logic to be more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithan committed Feb 20, 2014
1 parent d49c3d7 commit 6f832a8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions readthedocs/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

from django.contrib.auth.models import User
from django.core.urlresolvers import NoReverseMatch, reverse
from django.core.urlresolvers import reverse
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseNotFound
from django.shortcuts import render_to_response, get_object_or_404, redirect
Expand All @@ -22,7 +22,6 @@
from core.forms import FacetedSearchForm
from projects.models import Project, ImportedFile, ProjectRelationship
from projects.tasks import update_docs, remove_dir
from projects.utils import highest_version

import json
import mimetypes
Expand Down Expand Up @@ -156,9 +155,11 @@ def _build_branches(project, branch_list):

def _build_url(url, branches):
try:
projects = Project.objects.filter(repo__contains=url)
projects = Project.objects.filter(repo__endswith=url)
if not projects.count():
raise NoProjectException()
projects = Project.objects.filter(repo__endswith=url + '.git')
if not projects.count():
raise NoProjectException()
for project in projects:
(to_build, not_building) = _build_branches(project, branches)
if to_build:
Expand Down Expand Up @@ -301,7 +302,7 @@ def default_docs_kwargs(request, project_slug=None):
try:
proj = Project.objects.get(slug=project_slug)
except (Project.DoesNotExist, ValueError):
# Try with underscore, for legacy
# Try with underscore, for legacy
try:
proj = Project.objects.get(slug=project_slug.replace('-', '_'))
except (Project.DoesNotExist):
Expand All @@ -312,7 +313,7 @@ def default_docs_kwargs(request, project_slug=None):
try:
proj = Project.objects.get(slug=request.slug)
except (Project.DoesNotExist, ValueError):
# Try with underscore, for legacy
# Try with underscore, for legacy
try:
proj = Project.objects.get(slug=request.slug.replace('-', '_'))
except (Project.DoesNotExist):
Expand Down

0 comments on commit 6f832a8

Please sign in to comment.