Re: [vhffs-dev] Modify Git Repository Description

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Hi Sylvain,

thanks a lot for your help! You did most of the job fixing the Perl
mistakes and replicating to other version control system.

I'm very glad that my contribution helped.

Regards,
François
 




Le jeudi 03 mai 2018 à 17:06 +0200, Sylvain Rochet a écrit :
> Hi François,
> 
> On Thu, May 03, 2018 at 04:58:38PM +0200, Sylvain Rochet wrote:
> > On Tue, Apr 17, 2018 at 12:07:28PM +0200, François Mazen wrote:
> > >  
> > > +	if(defined $description) {
> > > +		$git->set_description($description);
> > > +		$git-
> > > >set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
> > > +	}
> > > +	else {
> > > +		$panel->add_error( gettext('You must enter a
> > > description') );
> > > +	}
> > > +
> > 
> > We can't set object state to WAITING_FOR_MODIFICATION here. If
> > anything 
> > next fail we must not redirect the user to the group preference
> > page 
> > with a successful message, which is what actually happen if object
> > state 
> > is set to WAITING_FOR_MODIFICATION.
> > 
> > Therefore we need to check all user input before trying to set
> > them, and 
> > we need to set object state to WAITING_FOR_MODIFICATION last.
> > 
> > I agree it was tricky because the previous code was wrong :-)
> 
> Added to that, /defined/ in Perl only mean that the variable exists,
> not 
> that the variable is not empty. A correct way to check if a variable
> is 
> a string, not empty, and discarding spaces/tabs only strings, is to 
> check the string against a regexp, usually /^\s*$/.
> 
> Sylvain

Attachment: signature.asc
Description: This is a digitally signed message part



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/