File tree Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 1616 package_dir = {"" : "src" },
1717 packages = ["cs50" ],
1818 url = "https://github.com/cs50/python-cs50" ,
19- version = "3.0.0 "
19+ version = "3.0.1 "
2020)
Original file line number Diff line number Diff line change 11from distutils .version import StrictVersion
2+ from os import getenv
23from pkg_resources import get_distribution
34
45from .cs50 import formatException
910 # Only patch >= 1.0
1011 version = StrictVersion (get_distribution ("flask" ).version )
1112 assert version >= StrictVersion ("1.0" )
12- import flask .logging
1313
1414 # Reformat logger's exceptions
1515 # http://flask.pocoo.org/docs/1.0/logging/
1616 # 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
1836
1937except :
2038 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