Changes between Initial Version and Version 3 of Ticket #5709


Ignore:
Timestamp:
Oct 8, 2007, 3:21:09 PM (17 years ago)
Author:
Malcolm Tredinnick
Comment:

(Fixed wiki formatting in description).

I'm not sure at the moment whether this is something to add to RegexField or not, but a couple of immediate things about the patch:

  1. don't compare "== None". Instead use "is None"; it's slightly more idiomatic Python and a little more efficient.
  2. Any new parameters should go at the end of the argument list so as not to introduce backwards incompatible changes (your patch breaks any code using position arguments to RegexField).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5709

    • Property Owner changed from nobody to Nathan Hoover
  • Ticket #5709 – Description

    initial v3  
    1 For conveinence, it would be nice if the RegexField supported inverse matching; i.e. the contents of the field do NOT match the regex when they're valid. I needed this in the course of using a RegexField for username signups. I have a list of undesirable usernames, like so:
    2 
     1For conveinence, it would be nice if the !RegexField supported inverse matching; i.e. the contents of the field do NOT match the regex when they're valid. I needed this in the course of using a !RegexField for username signups. I have a list of undesirable usernames, like so:
     2{{{
     3#!python
    34INVALID_USERNAME_REGEX = '(admin|root|add|edit|administrator|service)'
    4 
    5 Since it's not trival to make a regex that uses ^ against words rather than characters this is useful.
     5}}}
     6Since it's not trival to make a regex that uses `^` against words rather than characters this is useful.
Back to Top