Parent: [57c715] (diff)

Child: [e0c14c] (diff)

Download this file

widgets.py    27 lines (21 with data), 852 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import re
from formencode import validators as fev
import ew as ew_core
import ew.jinja2_ew as ew
from allura.lib.widgets.forms import ForgeForm
class ValidateSvnUrl(fev.URL):
url_re = re.compile(r'''
^(http|https|svn)://
(?:[%:\w]*@)? # authenticator
(?P<domain>[a-z0-9][a-z0-9\-]{,62}\.)* # subdomain
(?P<tld>[a-z]{2,63}|xn--[a-z0-9\-]{2,59}) # top level domain
(?::[0-9]{1,5})? # port
# files/delims/etc
(?P<path>/[a-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]*)?
$
''', re.I | re.VERBOSE)
class ImportForm(ForgeForm):
submit_text='Import'
class fields(ew_core.NameList):
checkout_url = ew.TextField(label='Checkout URL',
validator=ValidateSvnUrl(not_empty=True))