File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed
Expand file tree Collapse file tree 4 files changed +33
-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 = "2.4.5 "
19+ version = "2.5.0 "
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+ if getenv ("C9_HOSTNAME" ) and not getenv ("IDE_OFFLINE" ):
25+ try :
26+ import flask
27+ from werkzeug .contrib .fixers import ProxyFix
28+ before = flask .Flask .__init__
29+ def after (self , * args , ** kwargs ):
30+ before (self , * args , ** kwargs )
31+ self .wsgi_app = ProxyFix (self .wsgi_app )
32+ flask .Flask .__init__ = after
33+ except :
34+ pass
1835
1936except :
2037 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