[Collab-qa-commits] r2324 - udd/udd

Andreas Tille tille at alioth.debian.org
Mon May 14 09:59:23 UTC 2012


Author: tille
Date: 2012-05-14 09:59:23 +0000 (Mon, 14 May 2012)
New Revision: 2324

Modified:
   udd/udd/bibref_gatherer.py
Log:
Handle potentially float looking YAML values properly


Modified: udd/udd/bibref_gatherer.py
===================================================================
--- udd/udd/bibref_gatherer.py	2012-05-14 04:21:32 UTC (rev 2323)
+++ udd/udd/bibref_gatherer.py	2012-05-14 09:59:23 UTC (rev 2324)
@@ -133,10 +133,14 @@
       ref['source']  = source
       ref['key']     = key
       ref['package'] = package
-      if isinstance(references[r], int):
+      if isinstance(references[r], int) or isinstance(references[r], float):
         ref['value']   = str(references[r])
       else:
-        ref['value']   = references[r].strip()
+        try:
+          ref['value']   = references[r].strip()
+        except AttributeError, err:
+          self.log.error("Cannot parse value for source %s: r = %s -> value = %s" % (source, r, str(references[r])))
+          ref['value']   = '???'
         if key == 'author':
           # Try to catch broken author formating
           new_author = re.sub(',\s* and\s*' , ' and ', ref['value'])




More information about the Collab-qa-commits mailing list