fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Bug in multiline append


From: Jeff Forcier
Subject: Re: [Fab-user] Bug in multiline append
Date: Fri, 22 May 2009 07:45:44 -0400

> Ideally I think this is a case where the internals should be messy to
> leave the external api clean. You do not want regexp in the high level
> file functions (append, replace, comment, etc.) or do we?
>

Well, in some cases we *do*, because of the heavy grep/awk/etc usage
in these functions -- i.e.comment() and contains() have to take
regexes because that's *all* they do: search for lines matching a
regex.

However, with append(), as you noted, I left things in the unfortunate
state where the same input string is used as *both* a regex (the
interal contains() call) *and* a non-regex (the actual append). That
was a mistake on my part, and wasn't caught since my use of the
function has so far been limited to strings not containing
regex-specific characters :)

This needs to be fixed such that every string argument is clearly
defined as being used as a regex, or not, and then the question is
whether we fix append() by implicitly trying to make its single string
argument regex-safe (hopefully by leveraging some builtin function
like something in the 're' module, if one exists); by splitting that
into two arguments; or simply by removing the contains() check
entirely.

-Jeff




reply via email to

[Prev in Thread] Current Thread [Next in Thread]