Tim Legant wrote:
Jonathan Ellis <[EMAIL PROTECTED]> writes:

now that I look at it more, we're re-computing
string.lower(string.strip(str)) for compare w/ EACH line in the file.
I don't think the python compiler is smart enough to realize that's a
constant...
I'm not seeing this, but I suspect I'm looking in the wrong place.
Could you point out what part of the code you're looking at?  I'd like
to fix this when I check in your patch.
Util.py:
def append_to_file(str, fullpathname):
    """Append a string to a text file if it isn't already in there."""
    if os.path.exists(fullpathname):
        for line in fileinput.input(fullpathname):
            line = string.lower(string.strip(line))
            # Comment or blank line?
            if line == '' or line[0] in '#':
                continue
            else:
# --> here
                if string.lower(string.strip(str)) == line:
                    fileinput.close()
                    return 0
    file = open(fullpathname, 'a+')
    file.write(string.strip(str) + '\n')
    file.close()

-Jonathan

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to