[Zope] OT: possibly... Comparing 2 blobs

Bobb rawbobb@hotmail.com
Fri, 28 Mar 2003 16:43:24 -0500


Thanx Casey.

----- Original Message -----
From: "Casey Duncan" <casey@zope.com>
To: "Bobb" <rawbobb@hotmail.com>; <zope@zope.org>
Sent: Friday, March 28, 2003 4:35 PM
Subject: Re: [Zope] OT: possibly... Comparing 2 blobs


This Python script would be simple and fairly efficient in the common case
(assuming Zope Fileish objects):

##parameters=file1, file2
return file1.get_size() == file2.get__size() or str(file1) == str(file2)

It would only be inefficient for large files that were exactly the same
size,
which would be uncommon methinks. To make that case efficient, you would
need
to precompute a checksum at upload time and store it as a property for
comparison.

On Friday 28 March 2003 03:33 pm, Bobb wrote:
> Does anyone know of a "reliable" way to compare blobs in python / zope...
I'm looking a either comparing the first # of characters, or crc check or
something.
>
> TIA
>
> bobb