I want to forbid users being able to submit duplicate urls into the
database.
Right now my approach is:
db.url.URL.requires=[IS_URL(error_message='URL Error'),
IS_NOT_IN_DB(db, 'url.URL',error_message='Dupilcated
URL')]
It covers the case for with "http" and without "http".
For example, if www.123.com is already in database, then user could not
submit http://www.123.com.
But this approach does NOT cover the case with "https", i.e. the user still
could submit https://www.123.com.
Is there anyway to prevent such duplication?
I think eliminating the "http"/"https" ,if any, in urls before calling
SQLFORM().process(). In such way, the urls in database are all without
"http"/"https". But I don't know how to edit user input before calling
SQLFORM().process().
Right now my code is
url_form=SQLFORM(db.url).process()
Any ideas?
Thank you!
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.