Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 4009:e335ce40d6c8
Make URL matching code less matchy
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 01 Sep 2008 01:37:00 +0000 |
| parents | 13161539e5bd |
| children | 797eacd945af |
comparison
equal
deleted
inserted
replaced
| 4008:0bf9f8ae7d1b | 4009:e335ce40d6c8 |
|---|---|
| 1245 return self.is_edit_ok() | 1245 return self.is_edit_ok() |
| 1246 | 1246 |
| 1247 class StringHTMLProperty(HTMLProperty): | 1247 class StringHTMLProperty(HTMLProperty): |
| 1248 hyper_re = re.compile(r'''( | 1248 hyper_re = re.compile(r'''( |
| 1249 (?P<url> | 1249 (?P<url> |
| 1250 ((ht|f)tp(s?)://|www\.)? # prefix | 1250 ( |
| 1251 (ht|f)tp(s?):// # protocol | |
| 1251 ([\w]+:\w+@)? # username/password | 1252 ([\w]+:\w+@)? # username/password |
| 1252 (([\w\-]+\.)+([\w]{2,5})) # hostname | 1253 ([\w\-]+\.)+ # hostname |
| 1253 (:[\d]{1,5})? # port | 1254 [\w]{2,5} # TLD |
| 1254 (/[\w\-$.+!*(),;:@&=?/~\\#%]*)? # path etc. | 1255 | # ... or ... |
| 1256 www\. # "www." | |
| 1257 ([\w\-]+\.)+ # hostname | |
| 1258 [\w]{2,5} # TLD | |
| 1259 ) | |
| 1260 (:[\d]{1,5})? # port | |
| 1261 (/[\w\-$.+!*(),;:@&=?/~\\#%]*)? # path etc. | |
| 1255 )| | 1262 )| |
| 1256 (?P<email>[-+=%/\w\.]+@[\w\.\-]+)| | 1263 (?P<email>[-+=%/\w\.]+@[\w\.\-]+)| |
| 1257 (?P<item>(?P<class>[A-Za-z_]+)(\s*)(?P<id>\d+)) | 1264 (?P<item>(?P<class>[A-Za-z_]+)(\s*)(?P<id>\d+)) |
| 1258 )''', re.X | re.I) | 1265 )''', re.X | re.I) |
| 1259 protocol_re = re.compile('^(ht|f)tp(s?)://', re.I) | 1266 protocol_re = re.compile('^(ht|f)tp(s?)://', re.I) |
