Ajout d'un test pour getXmpAlt : il arrive que Lr3 produise des Alt vides.
[Photo.git] / metadata.py
index 96a44aa..c5e9ec4 100755 (executable)
@@ -24,6 +24,7 @@ $URL: http://svn.luxia.fr/svn/labo/projects/zope/Photo/trunk/metadata.py $
 """
 
 from AccessControl import ClassSecurityInfo
+from Acquisition import aq_base
 from Globals import InitializeClass
 from AccessControl.Permissions import view
 from ZODB.interfaces import BlobError
@@ -136,9 +137,10 @@ class Metadata :
                        node = index.get(path)
 
                        if node :
-                               firstLi = node['rdf:Alt/rdf:li']
-                               assert firstLi.unique, "More than one rdf:Alt (localisation not yet supported)"
-                               return firstLi.element.content
+                               firstLi = node.get('rdf:Alt/rdf:li')
+                               if firstLi :
+                                       assert firstLi.unique, "More than one rdf:Alt (localisation not yet supported)"
+                                       return firstLi.element.content
                return ''
 
        security.declarePrivate('getXmpProp')
@@ -168,7 +170,7 @@ class Metadata :
                root = info['root']
                rdfType = info['rdfType'].capitalize()
                methName = 'getXmp%s' % rdfType
-               meth = getattr(self.aq_base, methName)
+               meth = getattr(aq_base(self), methName)
                return meth(name, root)