Just wondering: Since the list of countries is (more or less) static, is it not easier to maintain a list of countries somewhere and match against it?
Regards Anand On Oct 5, 9:06 am, Iceberg <iceb...@21cn.com> wrote: > The IS_UPPER() is based on python's upper(). In python document it > said, > > Return a copy of the string converted to uppercase. > For 8-bit strings, this method is locale-dependent. > > So if your locale doesn't work for some reason, I think you can at > least customize your own IS_UPPER(), and convert those characters > explicitly. > > On Oct5, 5:06am, Sophie <kfarron...@gmail.com> wrote: > > > I dont understand, i have a databse i want to insert PERÚ, so i put > > this in my code > > IS_UPPER(),IS_MATCH('([a-zA-Z]*[ ]*[á]*[é]*[í]*[ó]*[ú]*[ñ]*[Á]*[É]*[Í]* > > [Ó]*[Ú]*[Ñ]*) +',error_message='Only a-z, A-z, spaces, á.é,í,ó, ú, Á, > > É,Í,Ó,Ú,ñ,Ñ') > > > but when i insert Perú, in the database is PERú, if is upper case why > > in the database isn't PERÚ. How can i resolve this > > > On 3 oct, 09:55, Jonathan Lundell <jlund...@pobox.com> wrote: > > > > On Oct 3, 2009, at 7:50 AM, mdipierro wrote: > > > > > something like this? > > > > > def MYVALIDATOR: > > > > def __init__(self,error_message): > > > > self.error_message=error_message > > > > def __call__(self,value): > > > > if not re.compile('^([a-zA-Z]*[ ]*[á]*[é]*[í]*[ó]*[ú]*)+ > > > > Why not: > > > > > if not re.compile('^([a-zA-Z áéíóú]*)+ > > > > Plus some others (like ñ). Plus their upper-case variants. > > > > Isn't there a proper Unicode way to do this? > > > > > $').match(value): > > > > return (value,self.error_message) > > > > else: > > > > newvalue='' > > > > for c in value: > > > > if c in 'áéíóú': new_values+=self.do_something(c) > > > > else: newvalue+=c.upper() > > > > return (newvalue,None) > > > > def do_something(self,c): > > > > return {'á':"A'",'é':"E'",'í':"I'",'ó':"O'",'ú':"U'"}[c] > > > > > requires=MYVALIDATOR()- Ocultar texto de la cita - > > > > - Mostrar texto de la cita - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---