mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 05:12:54 +00:00 
			
		
		
		
	Refactor get_url to a lambda
This commit is contained in:
		@@ -10,11 +10,7 @@ BASEURL = getenv('BASEURL', '')
 | 
				
			|||||||
init_db()
 | 
					init_db()
 | 
				
			||||||
app = Flask(__name__)
 | 
					app = Flask(__name__)
 | 
				
			||||||
app.secret_key = urandom(32)
 | 
					app.secret_key = urandom(32)
 | 
				
			||||||
 | 
					app.jinja_env.globals.update(get_url=lambda endpoint: f'{BASEURL}{url_for(endpoint)}') # pylint: disable=no-member
 | 
				
			||||||
 | 
					 | 
				
			||||||
def get_url(endpoint):
 | 
					 | 
				
			||||||
    return f'{BASEURL}{url_for(endpoint)}'
 | 
					 | 
				
			||||||
app.jinja_env.globals.update(get_url=get_url)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/', methods=['GET', 'POST'])
 | 
					@app.route('/', methods=['GET', 'POST'])
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user