File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -14,20 +14,21 @@ def _wrap_flask(f):
1414
1515 f .logging .default_handler .formatter .formatException = lambda exc_info : _formatException (* exc_info )
1616
17- if os .getenv ("CS50_IDE_TYPE" ) == "online" :
17+ if os .getenv ("CS50_IDE_TYPE" ):
1818 from werkzeug .middleware .proxy_fix import ProxyFix
1919 _flask_init_before = f .Flask .__init__
2020 def _flask_init_after (self , * args , ** kwargs ):
2121 _flask_init_before (self , * args , ** kwargs )
22- self .wsgi_app = ProxyFix (self .wsgi_app , x_proto = 1 )
22+ self .config ["TEMPLATES_AUTO_RELOAD" ] = True # Automatically reload templates
23+ self .wsgi_app = ProxyFix (self .wsgi_app , x_proto = 1 ) # For HTTPS-to-HTTP proxy
2324 f .Flask .__init__ = _flask_init_after
2425
2526
26- # Flask was imported before cs50
27+ # If Flask was imported before cs50
2728if "flask" in sys .modules :
2829 _wrap_flask (sys .modules ["flask" ])
2930
30- # Flask wasn't imported
31+ # If Flask wasn't imported
3132else :
3233 flask_loader = pkgutil .get_loader ('flask' )
3334 if flask_loader :
Original file line number Diff line number Diff line change @@ -333,10 +333,9 @@ def shutdown_session(exception=None):
333333 # Execute statement
334334 if self ._autocommit :
335335 connection .execute (sqlalchemy .text ("BEGIN" ))
336- result = connection .execute (sqlalchemy .text (statement ))
336+ result = connection .execute (sqlalchemy .text (statement ))
337+ if self ._autocommit :
337338 connection .execute (sqlalchemy .text ("COMMIT" ))
338- else :
339- result = connection .execute (sqlalchemy .text (statement ))
340339
341340 # Check for end of transaction
342341 if command in ["COMMIT" , "ROLLBACK" ]:
You can’t perform that action at this time.
0 commit comments