X-Git-Url: https://scm.cri.mines-paristech.fr/git/Photo.git/blobdiff_plain/a18ca54d896fa2f98cf2b7fb8955120ff5e0aa37..refs/heads/zope-2.12:/metadata.py diff --git a/metadata.py b/metadata.py index 96a44aa..310392b 100755 --- a/metadata.py +++ b/metadata.py @@ -19,11 +19,12 @@ ####################################################################################### """ Photo metadata read / write module -$Id: metadata.py 1272 2009-08-11 08:57:35Z pin $ -$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 @@ -70,7 +71,7 @@ class Metadata : """returns xmp metadata packet with xmpdump call """ if self.size : - blob_file_path = self.bdata._current_filename() + blob_file_path = self.bdata._p_blob_uncommitted or self.bdata._p_blob_committed dumpcmd = '%s %s' % (XMPDUMP, blob_file_path) p = Popen(dumpcmd, stdout=PIPE, stderr=PIPE, stdin=PIPE, shell=True) xmp, err = p.communicate() @@ -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)