Skip to content
Snippets Groups Projects
Commit e9b61d01 authored by Kenny Gao's avatar Kenny Gao
Browse files

Finished modifying error cases

Changed missing inst or site to 400 error
404 lists supported resources
If symbol not fully qualified, 400 unrecognized symbol spat out
parent ff8de5b9
No related branches found
No related tags found
1 merge request!2Order form
......@@ -152,9 +152,9 @@ json_symbol = {
'message': 'Server could not recognize symbol'
}
ascii_mal = '# Status: Error<br># Code: 400<br># Message: Server could not recognize symbol<br># Results: 0'
ascii_symbol = '# Status: Error<br># Code: 400<br># Message: Server could not recognize symbol<br># Results: 0'
xml_mal = createXML('400', 'Server could not recognize symbol')
xml_symbol = createXML('400', 'Server could not recognize symbol')
......
......@@ -295,12 +295,8 @@ def xmlReturn(site, inst, frame, symbols, sep, epoch):
stampElt.appendChild(stamp_content)
head.appendChild(stampElt)
#print(frame)
frame = frame.transpose()
print(frame)
print(symbols)
for symbol in symbols:
first = 0
......@@ -311,8 +307,6 @@ def xmlReturn(site, inst, frame, symbols, sep, epoch):
dataElt.setAttribute('site', site)
dataElt.setAttribute('inst', inst)
print(symbol)
dataList = frame[symbol]
for data in dataList:
if first == 0:
......@@ -442,7 +436,11 @@ def modifyData(fmt, begin, end, site, inst, symbols, interval, sep, callback, js
for symbol in symbols:
if('.' in symbol):
return 'malformed'
if(len(symbol.split('.')) != 3):
return 'unrecognizedSymbol'
else:
return 'malformed'
if(not interval):
......
......@@ -132,7 +132,6 @@ def asciiReturn(frame, sep, symbols, epoch):
output.write("# Fields: " + epoch + ' since epoch (1970-01-01 00:00:00)')
for symbol in symbols:
print(symbol)
output.write(sep + symbol)
output.write('<br/>')
......
......@@ -139,8 +139,6 @@ def handleMultiSites(fmt):
modifiedSymbols = multiData.processSymbols(modifiedSymbols)
print(frame)
frame = frame[modifiedSymbols]
if(fmt == 'ascii'):
......@@ -179,7 +177,7 @@ def handleSingleSite(fmt):
endTime, site, inst, symbols, interval,
sep, callback, jsonFormat, epoch)
print(result)
print(result)
if(isinstance(result, int)):
return handleIntError(result, fmt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment