File tree 4 files changed +34
-3
lines changed
4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 16
16
package_dir = {"" : "src" },
17
17
packages = ["cs50" ],
18
18
url = "https://github.com/cs50/python-cs50" ,
19
- version = "3.0.0 "
19
+ version = "3.0.1 "
20
20
)
Original file line number Diff line number Diff line change 1
1
from distutils .version import StrictVersion
2
+ from os import getenv
2
3
from pkg_resources import get_distribution
3
4
4
5
from .cs50 import formatException
9
10
# Only patch >= 1.0
10
11
version = StrictVersion (get_distribution ("flask" ).version )
11
12
assert version >= StrictVersion ("1.0" )
12
- import flask .logging
13
13
14
14
# Reformat logger's exceptions
15
15
# http://flask.pocoo.org/docs/1.0/logging/
16
16
# https://docs.python.org/3/library/logging.html#logging.Formatter.formatException
17
- flask .logging .default_handler .formatter .formatException = lambda exc_info : formatException (* exc_info )
17
+ try :
18
+ import flask .logging
19
+ flask .logging .default_handler .formatter .formatException = lambda exc_info : formatException (* exc_info )
20
+ except :
21
+ pass
22
+
23
+ # Add support for Cloud9 proxy so that flask.redirect doesn't redirect from HTTPS to HTTP
24
+ # http://stackoverflow.com/a/23504684/5156190
25
+ if getenv ("C9_HOSTNAME" ) and not getenv ("IDE_OFFLINE" ):
26
+ try :
27
+ import flask
28
+ from werkzeug .contrib .fixers import ProxyFix
29
+ before = flask .Flask .__init__
30
+ def after (self , * args , ** kwargs ):
31
+ before (self , * args , ** kwargs )
32
+ self .wsgi_app = ProxyFix (self .wsgi_app )
33
+ flask .Flask .__init__ = after
34
+ except :
35
+ pass
18
36
19
37
except :
20
38
pass
Original file line number Diff line number Diff line change
1
+ import cs50
2
+ from flask import Flask , redirect , render_template
3
+
4
+ app = Flask (__name__ )
5
+
6
+ @app .route ("/" )
7
+ def index ():
8
+ return redirect ("/foo" )
9
+
10
+ @app .route ("/foo" )
11
+ def foo ():
12
+ return render_template ("foo.html" )
Original file line number Diff line number Diff line change
1
+ foo
You can’t perform that action at this time.
0 commit comments