On Wed, 9 Feb 2000, Evan Gibson wrote:
What I _think_ is happening is that gadfly can't handle carriage returns and line feeds in the string input. (Which is why I was trying things like "virtual" to perhaps get rid of them.)
This is an all-too-frequently asked question. First, pay no attention to people who say it's a bug in gadfly. The fundamental problem is that there is no SQL standard for including linebreaks in strings. Any solution for including the linebreaks that works with one database is pretty much guaranteed not to work with another. You don't want to be locked in to using one database (I know: I've been forced to move from gadfly so that non-python tools can get to the data).
Is there a way I can remove the carriage returns prior to hitting the sql? I was hoping to use some kind of formatting command rather than trying some weird kind of _.string.sub call.
I use a simple whitespace cleaner: _.string.join(_.string.split(textfield)) This is the simplest thing if you don't care about the original linebreaks (I warn my users that linebreaks will be ignored). If your text is destined only for HTML and you want to preserve line breaks, you could instead use _.string.join(_.string.split(textfield, '\n'), '<BR>'). I decided to keep HTML out of my database; you may decide otherwise. Hope this helps. joe