[EP-tech] Re: Patch suggestion: Form value of MetaField::Name fields having surrounding spaces stripped off

Ranju Upadhyay Ranju.Upadhyay at nuim.ie
Fri Oct 18 09:41:23 BST 2013


I have noticed that the issue of trailing spaces and spaces in between the
words in several fields happens during the process of db upgrade as well. In
our upgrade to 3.3.12 from 3.0.5 this happened in the department field which
causes views to these departments listed more than once ( which in the older
version would have been listed only once). I ran update stmts in db to fix
it but may be if the patch is in the code permanently that might not happen!

 

Thanks

Ranju Upadhyay

National University of Ireland Maynooth.

 

From: eprints-tech-bounces at ecs.soton.ac.uk
[mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Sebastien
Francois
Sent: 17 October 2013 12:53
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Patch suggestion: Form value of MetaField::Name
fields having surrounding spaces stripped off

 

Hi Florian,

See https://github.com/eprints/eprints/issues/11 and its fix perhaps?

Could you also raise a ticket in github for your issue (if not fixed by the
above patch) please?

Thanks!
Seb.

On 17/10/13 12:46, Florian Heß wrote:

Hi E-Prints developers,
 
if the user happens to leave trailing spaces in the name field, the 
browse view would display the name once more and ignore that the name 
already exists without trailing space. That's why the creator's browse 
view accumulates doubles and maybe triples of names over time. So how 
about stripping off accidentally input spaces so the repos browse views 
- those generated of fields with freely entered values - are kept clean?
 
Please tell me if the patch will be applied officially in the next 
version of EPrints, or if I am rather to use the fromform()-callback. In 
my opinion, this issue isn't specific to our repository, hence ...
 
# in package MetaField::Name ...
# inspired from sub &MetaField::Multipart::form_value_basic
sub form_value_basic
{
         my( $self, $session, $basename ) = @_;
 
         my $value = 
$self->EPrints::MetaField::Compound::form_value_basic( $session, 
$basename );
 
         s{^\s+}{}, s{\s+$}{} for values %$value;
 
         return $value;
}
 
The patch has been roughly tested.
 
Kind regards,
Florian
 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20131018/b528e234/attachment.html 


More information about the Eprints-tech mailing list