summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/wsgi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/wsgi/atomutil.py6
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/composite.py4
-rw-r--r--sca-cpp/trunk/modules/wsgi/httputil.py4
3 files changed, 10 insertions, 4 deletions
diff --git a/sca-cpp/trunk/modules/wsgi/atomutil.py b/sca-cpp/trunk/modules/wsgi/atomutil.py
index 106e69c3c6..8e812abbe9 100644
--- a/sca-cpp/trunk/modules/wsgi/atomutil.py
+++ b/sca-cpp/trunk/modules/wsgi/atomutil.py
@@ -54,6 +54,12 @@ def isATOMFeed(l):
return False
return contains(car(l), "<feed") and contains(car(l), "=\"http://www.w3.org/2005/Atom\"")
+# Return true if a list of strings represents an ATOM entry
+def isATOMEntry(l):
+ if not isXML(l):
+ return False
+ return contains(car(l), "<entry") and not contains(car(l), "<feed") and contains(car(l), "=\"http://www.w3.org/2005/Atom\"")
+
# Convert a list of strings to a list of values representing an ATOM feed
def readATOMFeed(l):
f = readXML(l)
diff --git a/sca-cpp/trunk/modules/wsgi/composite.py b/sca-cpp/trunk/modules/wsgi/composite.py
index ffd971fef5..9dbc2c911a 100755
--- a/sca-cpp/trunk/modules/wsgi/composite.py
+++ b/sca-cpp/trunk/modules/wsgi/composite.py
@@ -184,8 +184,8 @@ def application(e, r):
# Write an ATOM feed or entry
if isString(car(v)) and isString(cadr(v)):
if isNil(id):
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=feed"),), writeATOMFeed(feedValuesToElements(v)))
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=entry"),), writeATOMEntry(entryValuesToElements(v)))
+ return result(e, r, 200, (("Content-type", "application/atom+xml"),), writeATOMFeed(feedValuesToElements(v)))
+ return result(e, r, 200, (("Content-type", "application/atom+xml"),), writeATOMEntry(entryValuesToElements(v)))
# Write a JSON value
return result(e, r, 200, (("Content-type", "application/json"),), writeJSON(valuesToElements(v)))
diff --git a/sca-cpp/trunk/modules/wsgi/httputil.py b/sca-cpp/trunk/modules/wsgi/httputil.py
index ea00f3f9fe..842460cc6a 100644
--- a/sca-cpp/trunk/modules/wsgi/httputil.py
+++ b/sca-cpp/trunk/modules/wsgi/httputil.py
@@ -58,13 +58,13 @@ class client:
ct = res.getheader("Content-type", "text/plain")
ls = (res.read(),)
- if contains(ct, "application/atom+xml;type=entry"):
+ if atomutil.isATOMEntry(ls):
# Read an ATOM entry
v = atomutil.entryValue(atomutil.readATOMEntry(ls))
print >> stderr, "Client result", v
return v
- if contains(ct, "application/atom+xml;type=feed"):
+ if contains(ct, "application/atom+xml") or atomutil.isATOMFeed(ls):
# Read an ATOM feed
v = atomutil.feedValues(atomutil.readATOMFeed(ls))
print >> stderr, "Client result", v