EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #00417
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: Email MetaField validation
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: Email MetaField validation
- From: Tim Brody <tdb2@ecs.soton.ac.uk>
- Date: Wed, 18 Apr 2012 11:45:28 +0100
On Wed, 2012-04-18 at 16:10 +1000, Matthew Kerwin wrote: > In our ePrints installation we decided to make things a little easier > on the human when importing eprints, by relaxing validation to allow > leading and trailing whitespace. To accommodate this relaxation I > modified EPrints::MetaField::Email, adding a form_value_basic method > that subsequently strips said whitespace, thus: > > ---------- > sub form_value_basic > { > my $self = shift; > my $v = $self->SUPER::form_value_basic( @_ ); > # strip leading and trailing whitespace > $v =~ s/^\s+|\s+$//g; > return $v; > } > ---------- > > Is this the right approach, or is there a better point where I can > intercept the data before it hits our back-end store? And if this is > the right place for sanitisation, should the method be patched in > upstream? If you wanted to override a single field you could set its "fromform" property. Either way, the "form_value_basic" method is unlikely to change anytime soon, so you should be safe overriding that method. > Further, is there a reason that any meta-field would ever want leading > and trailing whitespace? Whatever approach ends up being used to > sanitise the data, should it apply to all meta-fields, or just email? I have pondered this before. I think I was just scared about making such a wide-ranging change :-) -- All the best, Tim
Attachment:
signature.asc
Description: This is a digitally signed message part
- References:
- [EP-tech] Google analytics
- From: <Gaston.Fournier@etsmtl.ca>
- [EP-tech] Re: Google analytics
- From: Mark Gregson <mark.gregson@qut.edu.au>
- [EP-tech] Re: Google analytics
- From: "Dimitrakakis Georgios" <giorgis@lib.uoc.gr>
- [EP-tech] Re: Google analytics
- From: Denis Pitzalis - STARC <d.pitzalis@cyi.ac.cy>
- [EP-tech] Re: Google analytics
- From: Mark Gregson <mark.gregson@qut.edu.au>
- [EP-tech] Email MetaField validation
- From: Matthew Kerwin <matthew.kerwin@qut.edu.au>
- [EP-tech] Google analytics
- Prev by Date: [EP-tech] Re: Google analytics
- Next by Date: [EP-tech] Re: Google analytics
- Previous by thread: [EP-tech] Email MetaField validation
- Next by thread: [EP-tech] Re: Google analytics
- Index(es):