[Zope3-checkins] CVS: Zope3/src/zope/app/dublincore - xmlmetadata.py:1.5

Fred L. Drake, Jr. fred at zope.com
Fri Sep 5 15:34:16 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/dublincore
In directory cvs.zope.org:/tmp/cvs-serv11918

Modified Files:
	xmlmetadata.py 
Log Message:
when checking that an encoding is allowed for a particular field,
check for it being allowed in less-qualified versions of the field as
well (for example, W3CDTF should be allowed for Date.Created as well
as Date)


=== Zope3/src/zope/app/dublincore/xmlmetadata.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/dublincore/xmlmetadata.py:1.4	Thu Aug 28 19:27:32 2003
+++ Zope3/src/zope/app/dublincore/xmlmetadata.py	Fri Sep  5 14:34:15 2003
@@ -209,7 +209,12 @@
             if type not in dcterms.encodings:
                 raise ValueError("unknown data type: %r" % type)
             allowed_in, validator = dcterms.encodings[type]
-            if dcelem not in allowed_in:
+            dcelem_split = dcelem.split(".")
+            for elem in allowed_in:
+                elem_split = elem.split(".")
+                if dcelem_split[:len(elem_split)] == elem_split:
+                    break
+            else:
                 raise ValueError("%s values are not allowed for %r"
                                  % (type, dcelem))
             dcelem = "%s.%s" % (dcelem, type)




More information about the Zope3-Checkins mailing list