Merge lp:~canonical-ca-hackers/ubuntu-webcatalog/add-use-https into lp:ubuntu-webcatalog

Proposed by Łukasz Czyżykowski
Status: Merged
Approved by: Anthony Lenton
Approved revision: 94
Merged at revision: 95
Proposed branch: lp:~canonical-ca-hackers/ubuntu-webcatalog/add-use-https
Merge into: lp:ubuntu-webcatalog
Diff against target: 21 lines (+4/-0)
1 file modified
src/webcatalog/wsgi.py (+4/-0)
To merge this branch: bzr merge lp:~canonical-ca-hackers/ubuntu-webcatalog/add-use-https
Reviewer Review Type Date Requested Status
Canonical Consumer Applications Hackers Pending
Review via email: mp+100151@code.launchpad.net

Commit message

Add os.environ['HTTPS'] to wsgi app creation when should_serve_https config is on.

Unofortunately there's no way of actually testing that, at least nothing I come up with.

Description of the change

Adds code to set os.environ['HTTPS'] = 'on' as this is where django checks for request.is_secure()

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/webcatalog/wsgi.py'
2--- src/webcatalog/wsgi.py 2012-01-06 17:54:47 +0000
3+++ src/webcatalog/wsgi.py 2012-03-30 13:53:46 +0000
4@@ -17,6 +17,7 @@
5
6 """wsgi stack for the Apps Directory."""
7
8+import os
9 import logging.config
10 import platform
11
12@@ -28,6 +29,9 @@
13
14 def make_app():
15 """Encapsulate our webcatalog handler in an OOPS app."""
16+ if settings.SHOULD_SERVE_HTTPS:
17+ os.environ['HTTPS'] = 'on'
18+
19 default_id = ''.join(x for x in platform.node() if x.isalpha())
20 appserver_id = getattr(settings, 'APPSERVER_ID', default_id)
21 logging.config.fileConfig(settings.WEBAPP_LOGGING_CONFIG)

Subscribers

People subscribed via source and target branches