diff --git a/src/02-shipping/PlainText.mxml b/src/02-shipping/PlainText.mxml
index 3774a2c..9db6481 100644
--- a/src/02-shipping/PlainText.mxml
+++ b/src/02-shipping/PlainText.mxml
@@ -1,9 +1,47 @@
-
-
-
-
-
-
+ xmlns:mx="http://www.adobe.com/2006/mxml"
+ layout="absolute"
+ backgroundColor="#FFFFFF"
+ backgroundImage="">
+
+
+
+
+
+
+
+ {zipcode.text}
+ {weight_lb.text}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/02-shipping/shipping.py b/src/02-shipping/shipping.py
index 63279bb..be5573a 100644
--- a/src/02-shipping/shipping.py
+++ b/src/02-shipping/shipping.py
@@ -19,6 +19,7 @@ def shipping_app(environ, start_response):
handler = {
'text': plaintext_handler,
'xml': xml_handler,
+ 'crossdomain.xml': crossdomain_xml_handler,
}.get(path_info)
if handler:
@@ -48,8 +49,8 @@ def get_params(environ):
def xml_handler(environ, start_response):
params = get_params(environ)
- zipcode = int(params.get('zipcode', 0))
- pounds = int(params.get('pounds', 0))
+ zipcode = int(float(params.get('zipcode', 0)))
+ pounds = int(float(params.get('pounds', 0)))
ret = ['']
for service, price in get_shipping_options(zipcode, pounds).iteritems():
@@ -67,8 +68,8 @@ def xml_handler(environ, start_response):
def plaintext_handler(environ, start_response):
params = get_params(environ)
- zipcode = int(params.get('zipcode', 0))
- pounds = int(params.get('pounds', 0))
+ zipcode = int(float(params.get('zipcode', 0)))
+ pounds = int(float(params.get('pounds', 0)))
ret = []
for service, price in get_shipping_options(zipcode, pounds).iteritems():
@@ -82,6 +83,21 @@ def plaintext_handler(environ, start_response):
return [body]
+def crossdomain_xml_handler(environ, start_response):
+ start_response('200 OK', [
+ ('content-type', 'text/xml'),
+ ('content-length', str(len(XD_XML))),
+ ])
+ return [XD_XML]
+
+
+XD_XML = """\
+
+
+
+"""
+
+
def get_shipping_options(zipcode, pounds):
base_cost = (float(zipcode) / 10000.0) + (pounds * 5.0)
return {