write files only if they changed
Brought to you by:
blais
It would be very helpful, if existing files are only
written, if they have changed content. This would
help to minimize the amount of files one must upload
to the ISP web server. Not everyone has the luxury to
run his/her own web server, were this is less of an
issue.
Logged In: YES
user_id=332140
I patched my version of curator kind of quick and dirty to
do the trick described above. Please see the attached file.
The patch changes the following:
o calls to execTemplate() pass a file name, not a handle
o execTemplate() always writes a tmp file, compares it to
the existing file and copies it if there are differences
o empty filename is stdout
Does not handle the -i and -j parameter and gives an error
for the rc file, but it works. Well, quick and dirty. :-)
This little patch saves a lot of time during the upload!
patch for execTemplate()
Logged In: YES
user_id=332140
Hi, I changed the implementation for the execTemplate()
function. I now use the internal file diff instad of calling the
external executable. Also I forgot to close the file in the last
patch, which lead to a program hang. But now it works fine!
Logged In: YES
user_id=332140
forgot to attach the file ...
revised patch for execTemplate() function
Logged In: YES
user_id=332140
Line 2329 in my last patch need a change:
if afn == "" or (os.path.exists ( afn ) and filecmp.cmp (
tmpfile, afn )):