#5 write files only if they changed

open
nobody
None
5
2001-11-04
2001-11-04
Thomas Hammer
No

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.

Discussion

  • Thomas Hammer
    Thomas Hammer
    2001-11-07

    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!

     
  • Thomas Hammer
    Thomas Hammer
    2001-11-07

    patch for execTemplate()

     
    Attachments
  • Thomas Hammer
    Thomas Hammer
    2001-11-10

    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!

     
  • Thomas Hammer
    Thomas Hammer
    2001-11-10

    Logged In: YES
    user_id=332140

    forgot to attach the file ...

     
  • Thomas Hammer
    Thomas Hammer
    2001-11-10

    revised patch for execTemplate() function

     
    Attachments
  • Thomas Hammer
    Thomas Hammer
    2001-11-10

    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 )):