help-gnats
[Top][All Lists]
Advanced

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

Re: too many 'changed' entries


From: Dirk Schenkewitz
Subject: Re: too many 'changed' entries
Date: Wed, 07 May 2003 18:49:44 +0200

Hi All,

I finally found out the reason & solved my own problem.
Thank you very much, Mel, for turning me in the right direction!

Mel Hatzis wrote:
> 
> On 03/27/2003 06:04 AM, Dirk Schenkewitz submitted:
>
> > ...
>
> I noticed this too. In my case, I setup a field as 'required' and
> it wasn't working via gnatsweb, because gnatsweb was inserting a
> newline (thereby making the field look like it had a value).
> 
> I fixed it by changing the 'fix_multiline_val' sub, as follows:
> 
> sub fix_multiline_val
> {
>   my $val = shift;
>   $val =~ s/\r\n?/\n/g;
>   $val .= "\n" unless $val =~ /\n$/;
>   if ($val =~ /^\s*$/)
>   {
>     # don't allow whitespace values to circumvent 'required' fields
>     $val = "";
>   }
>   $val;
> }
> 
> This basically prevents whitespace only values from being entered
> as the (multiline) field value which I consider to be a good fix.
> 
> This should help you in the case where a newly created PR is edited
> for the first time - since this is when gnatsweb will add the
> newline, thereby changing the field and adding a change log to the
> audit trail.
> 
> Hope this helps.

It did, although not completely. Now I know that I caused the problem
by myself, by adding "-wrap=>'hard'" to the edit-fields. This was done
to preserve the format of an PR, esp. user-added line-breaks. Without
it I found no way to distinguish between user-added and gnatsweb-added
line-breaks. But it caused the following strange behaviour:
 - a soft linebreak was inserted as a single <CR><LF> sequence.
 - a hard (user-added) linebreak was inserted as <CR><LF><CR><LF><CR><LF>.

I found no way to avoid that. Finally I changed 'fix_multiline_val'
into the attached one. From then on, everything worked like I wanted:
 - Soft linebreaks do not make it into the PR
 - Hard linebreaks go into the PR as-is.

I send this to the list just in case someone else wants this behaviour
or stumbles over it. It's not a Gnatsweb bug but merely a perl-cgi bug.
But it seems the only way to get rid of it is a special version of
'fix_multiline_val'.

Have fun.
        dirk

-- 
Dirk Schenkewitz 

InterFace AG                 fon: +49 (0)89 / 610 49 - 126
Leipziger Str. 16            fax: +49 (0)89 / 610 49 - 83
D-82008 Unterhaching         
http://www.interface-ag.de   mailto:address@hidden

Attachment: fix_multiline_val.pl
Description: Perl program


reply via email to

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