webapp/routes.py
def static_loader():
	"""
	GET:
		description: single route for requesting concatenated static files, either JS or CSS

		args:
			t: type of file, either "js" or "css"

			q: filenames of requested files in order, separated by "&" in the url

		security: None required

		responses:
			200: returns the requested js or css files all concatenated together

			404: error not found if the requested filetype is neither js or css

	:authors:
		- Matt
	:returns: HTTP Response
	"""
	# lookup table for mimetypes
	mimetype_lookup = {
		"js": "text/javascript",
		"css": "text/css"
	}
	# load url args from request object
	args = request.args
	filetype = args["t"]
	if filetype in ["js", "css"]:
		file_list = args["q"].split(" ")
		output = []
		for file in file_list:
			# load and concatenate all of the requested files
			with open(
					str(app.config['ROOT_FOLDER'] + "/webapp/static/" + filetype + "/" + file).replace("\\", "/"),
					"r") as contents:
				output.append(contents.read())
		# create http response from concatenated files
		response = make_response("\n".join(output))
		# set correct mimetype for response
		response.mimetype = mimetype_lookup[filetype]
		return response
	else:
		abort(404)

	GET:
		description: single route for requesting concatenated static files, either JS or CSS

		args:
			t: type of file, either "js" or "css"

			q: filenames of requested files in order, separated by "&" in the url

		security: None required

		responses:
			200: returns the requested js or css files all concatenated together

			404: error not found if the requested filetype is neither js or css

	:authors:
		- Matt
	:returns: HTTP Response
	
single route for requesting concatenated static files, either JS or CSS

type of file, either "js" or "css"

filenames of requested files in order, separated by "&" in the url

None required

returns the requested js or css files all concatenated together

error not found if the requested filetype is neither js or css
single route for requesting concatenated static files either JS or CSS type of file either " js " or " css " filenames of requested files in order separated by " & " in the url None required returns the requested js or css files all concatenated together error not found if the requested filetype is neither js or css
def static_loader():
	mimetype_lookup = {
		"js": "text/javascript",
		"css": "text/css"
	}
	args = request.args
	filetype = args["t"]
	if filetype in ["js", "css"]:
		file_list = args["q"].split(" ")
		output = []
		for file in file_list:
			with open(
					str(app.config['ROOT_FOLDER'] + "/webapp/static/" + filetype + "/" + file).replace("\\", "/"),
					"r") as contents:
				output.append(contents.read())
		response = make_response("\n".join(output))
		response.mimetype = mimetype_lookup[filetype]
		return response
	else:
		abort(404)
def static_loader ( ) : mimetype_lookup = { "js" : "text/javascript" , "css" : "text/css" } args = request . args filetype = args [ "t" ] if filetype in [ "js" , "css" ] : file_list = args [ "q" ] . split ( " " ) output = [ ] for file in file_list : with open ( str ( app . config [ 'ROOT_FOLDER' ] + "/webapp/static/" + filetype + "/" + file ) . replace ( "\\" , "/" ) , "r" ) as contents : output . append ( contents . read ( ) ) response = make_response ( "\n" . join ( output ) ) response . mimetype = mimetype_lookup [ filetype ] return response else : abort ( 404 )
GET:
description: single route for requesting concatenated static files, either JS or CSS
GET : description : single route for requesting concatenated static files either JS or CSS
"""
	GET:
		description: single route for requesting concatenated static files, either JS or CSS

		args:
			t: type of file, either "js" or "css"

			q: filenames of requested files in order, separated by "&" in the url

		security: None required

		responses:
			200: returns the requested js or css files all concatenated together

			404: error not found if the requested filetype is neither js or css

	:authors:
		- Matt
	:returns: HTTP Response
	""" # lookup table for mimetypes # load url args from request object # load and concatenate all of the requested files # create http response from concatenated files # set correct mimetype for response
None
authors
None