[Python-checkins] distutils2: Pass attribute keys instead of Metadata fields.

tarek.ziade python-checkins at python.org
Sun Aug 8 11:50:46 CEST 2010


tarek.ziade pushed 430c897bd635 to distutils2:

http://hg.python.org/distutils2/rev/430c897bd635
changeset:   454:430c897bd635
user:        Alexis Metaireau <ametaireau at gmail.com>
date:        Wed Jul 21 18:54:58 2010 +0200
summary:     Pass attribute keys instead of Metadata fields.
files:       src/distutils2/metadata.py

diff --git a/src/distutils2/metadata.py b/src/distutils2/metadata.py
--- a/src/distutils2/metadata.py
+++ b/src/distutils2/metadata.py
@@ -337,6 +337,9 @@
 
     def update(self, other=None, **kwargs):
         """Set metadata values from the given mapping
+        
+        Convert the keys to Metadata fields. Given keys that don't match a
+        metadata argument will not be used.
 
         If overwrite is set to False, just add metadata values that are
         actually not defined.
@@ -347,8 +350,8 @@
         Empty values (e.g. None and []) are not setted this way.
         """
         def _set(key, value):
-            if value not in ([], None):
-                self.set(key, value)
+            if value not in ([], None) and key in _ATTR2FIELD:
+                self.set(self._convert_name(key), value)
 
         if other is None:
             pass

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list