Skip to content

Commit

Permalink
Remove urlconf handling in proxito middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher committed May 26, 2020
1 parent 883169f commit 33be20b
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions readthedocs/proxito/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,6 @@ def process_request(self, request): # noqa
# Otherwise set the slug on the request
request.host_project_slug = request.slug = ret

try:
project = Project.objects.get(slug=request.host_project_slug)
except Project.DoesNotExist:
log.exception('No host_project_slug set on project')
return None

# This is hacky because Django wants a module for the URLConf,
# instead of also accepting string
if project.urlconf:

# Stop Django from caching URLs
project_timestamp = project.modified_date.strftime("%Y%m%d.%H%M%S")
url_key = f'readthedocs.urls.fake.{project.slug}.{project_timestamp}'

log.info(
'Setting URLConf: project=%s url_key=%s urlconf=%s',
project, url_key, project.urlconf,
)
if url_key not in sys.modules:
sys.modules[url_key] = project.proxito_urlconf
request.urlconf = url_key

return None

def process_response(self, request, response): # noqa
Expand Down

0 comments on commit 33be20b

Please sign in to comment.