Skip to content

Commit

Permalink
mimetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kouznetsov committed Nov 6, 2012
1 parent c10c74b commit 8696a6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions agentum/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
agent|cell <id>|all in|out param [param [param] ...]
agent|cell <id>|all param value [param value [param value] ...]
Packed frame:
cell frame param [value, ...]
Input:
Expand Down
17 changes: 11 additions & 6 deletions agentum/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import logging
import optparse
import signal
import mimetypes

from agentum.simulation import Simulation
from agentum import worker as w
Expand Down Expand Up @@ -146,12 +147,16 @@ def app(environ, start_response):
'static',
path)
#import ipdb; ipdb.set_trace()
response_body = open(FILE).read()
status = '200 OK'
headers = [('Content-type', 'text/html'), ('Content-Length', str(len(response_body)))]
#headers = [('Content-Length', str(len(response_body)))]
start_response(status, headers)
return [response_body]
if os.path.isfile(FILE):
response_body = open(FILE).read()
status = '200 OK'
mimetype = mimetypes.guess_type(FILE)[0]
headers = [('Content-type', mimetype),
('Content-Length', str(len(response_body)))]
start_response(status, headers)
return [response_body]
else:
return None

ws_server = pywsgi.WSGIServer(
('', 9990), app,
Expand Down

0 comments on commit 8696a6e

Please sign in to comment.