Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#657 closed defect (wontfix)

validator - characters without numbers

Reported by: Bless Owned by: adrian
Component: Validators Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It should be a validator for characters without numbers, because is possible that you want whatever text minus numbers.

num_re = re.compile(r'\d')

def thereisNumeric:
    if num_re.search(field_data):
        raise ValidationError, "This value musn't contain numbers."

Attachments (0)

Change History (6)

comment:1 Changed 9 years ago by anonymous

  • Component changed from Admin interface to Validators

comment:2 Changed 9 years ago by BleSS

Examples of field data:

"foo bar" -> validators.isOnlyLetters fails by the space
"foo-bar"
"foo;bar"

comment:3 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

This is a bit too obscure for inclusion in the standard validator library, I think. Feel free to write your own validator and use it within your own code.

comment:4 Changed 9 years ago by BleSS

  • Resolution wontfix deleted
  • Status changed from closed to reopened

I believe that now it's more clear

num_re = re.compile(r'\d')

def isCharacterNotNumeric(field_data, all_data):
    if num_re.search(field_data):
        raise ValidationError, "This value must not contain numbers."

I think that it would be useful

comment:5 Changed 9 years ago by BleSS

I wrote wrong the raise

        raise ValidationError, "This value must not contain numeric characters."

comment:6 Changed 9 years ago by BleSS

  • Resolution set to wontfix
  • Status changed from reopened to closed

adrian, you had reason. I'll use my own validator.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.