From c9e209ba8d8aa277d8594ecae8bc8859d2faab90 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Thu, 10 May 2007 20:35:47 -0400 Subject: [PATCH] Ensure atom:author elements have atom:name children --- planet/reconstitute.py | 6 +++++- tests/data/reconstitute/author_noname.xml | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/data/reconstitute/author_noname.xml diff --git a/planet/reconstitute.py b/planet/reconstitute.py index 1a914ec..29e371d 100644 --- a/planet/reconstitute.py +++ b/planet/reconstitute.py @@ -124,7 +124,11 @@ def author(xentry, name, detail): xdoc = xentry.ownerDocument xauthor = xdoc.createElement(name) - createTextElement(xauthor, 'name', detail.get('name', None)) + if detail.get('name', None): + createTextElement(xauthor, 'name', detail.get('name')) + else: + xauthor.appendChild(xdoc.createElement('name')) + createTextElement(xauthor, 'email', detail.get('email', None)) createTextElement(xauthor, 'uri', detail.get('href', None)) diff --git a/tests/data/reconstitute/author_noname.xml b/tests/data/reconstitute/author_noname.xml new file mode 100644 index 0000000..340ec7b --- /dev/null +++ b/tests/data/reconstitute/author_noname.xml @@ -0,0 +1,13 @@ + + + + + + john@example.com + + + +