EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #02326


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

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


Am 17.10.2013 13:52, schrieb Sebastien Francois:
Hi Florian,

See
<https://github.com/eprints/eprints/commit/961e1591009b777ad65015d185cdd9d6eb2863ce>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?


Well, the above patch relates to MetaField::Id, not MetadataField::Name, ::Text or others which accept string input by the user. A new ticket is hardly worth it in my eyes, how about simply re-opening the existing one? Sorry, I am new to github, but sooner or later I know I should have a github account.

Kind regards,
Florian

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




*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/



--
UB Heidelberg (Altstadt)
Plöck 107-109, 69117 HD
Abt. Informationstechnik
Tel. 06221 / 54 3550
http://www.ub.uni-heidelberg.de/