[ckan-changes] commit/ckanext-csw: amercader: Try to parse to string the Element instead of ElementTree

Bitbucket commits-noreply at bitbucket.org
Fri Jul 29 11:37:41 UTC 2011


1 new changeset in ckanext-csw:

http://bitbucket.org/okfn/ckanext-csw/changeset/e2086b4d58fa/
changeset:   e2086b4d58fa
user:        amercader
date:        2011-07-29 13:37:15
summary:     Try to parse to string the Element instead of ElementTree
affected #:  1 file (107 bytes)

--- a/ckanext/csw/services.py	Mon May 30 15:38:11 2011 +0100
+++ b/ckanext/csw/services.py	Fri Jul 29 12:37:15 2011 +0100
@@ -121,6 +121,9 @@
             record["xml"] = etree.tostring(mdtree, pretty_print=True, xml_declaration=True)
         except TypeError:
             # API incompatibilities between different flavours of elementtree
-            record["xml"] = etree.tostring(mdtree)
+            try:
+                record["xml"] = etree.tostring(mdtree)
+            except AssertionError:
+                record["xml"] = etree.tostring(md)
         record["tree"] = mdtree
         return record

Repository URL: https://bitbucket.org/okfn/ckanext-csw/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list