luxia--
[Photo.git] / xmp.py
diff --git a/xmp.py b/xmp.py
index da36695..8738e50 100755 (executable)
--- a/xmp.py
+++ b/xmp.py
@@ -17,8 +17,8 @@
 #   along with this program; if not, write to the Free Software                       #
 #   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.   #
 #######################################################################################
 #   along with this program; if not, write to the Free Software                       #
 #   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.   #
 #######################################################################################
-# $Id: xmp.py 354 2008-02-13 13:30:53Z pin $
-# $URL: http://svn.luxia.fr/svn/labo/projects/zope/Photo/trunk/xmp.py $
+# 
+# 
 
 from types import StringTypes
 from logging import getLogger
 
 from types import StringTypes
 from logging import getLogger
@@ -72,9 +72,12 @@ class XMP(object) :
                        # tests / unwrap
                        reEncodedHeader = re.compile(self.XMP_HEADER_PATTERN.encode(self.encoding))
                        m = reEncodedHeader.match(packet)
                        # tests / unwrap
                        reEncodedHeader = re.compile(self.XMP_HEADER_PATTERN.encode(self.encoding))
                        m = reEncodedHeader.match(packet)
-                       assert m is not None, "No xmp header found"
-                       xmp = packet[m.end():]
+                       if m is None :
+                               console.warn('XMP packet wrapper not found')
+                               self.xmp = packet
+                               return
 
 
+                       xmp = packet[m.end():]
                        trailer = self.XMP_TRAILER[:-6].encode(self.encoding)  # TODO handle read-only mode
                        trailerPos = xmp.find(trailer)
                        assert trailerPos != -1, "No xmp trailer found"
                        trailer = self.XMP_TRAILER[:-6].encode(self.encoding)  # TODO handle read-only mode
                        trailerPos = xmp.find(trailer)
                        assert trailerPos != -1, "No xmp trailer found"