allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [5/5] git commit: [#7160] ticket:546 Allow IP addresses in URLs
Date Thu, 27 Mar 2014 16:12:32 GMT
[#7160] ticket:546 Allow IP addresses in URLs


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fd618a7e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fd618a7e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fd618a7e

Branch: refs/heads/master
Commit: fd618a7e4539fad714612506629a8c38d2f30d1b
Parents: efc7937
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Feb 27 12:40:52 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Mar 27 16:12:14 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/validators.py                | 5 +++++
 ForgeImporters/forgeimporters/trac/__init__.py | 4 +++-
 ForgeSVN/forgesvn/widgets.py                   | 8 +++++---
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fd618a7e/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index f23a951..964160d 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -25,6 +25,11 @@ from . import helpers as h
 from datetime import datetime
 
 
+class URL(fev.URL):
+    # allows use of IP address instead of domain name
+    require_tld = False
+
+
 class Ming(fev.FancyValidator):
 
     def __init__(self, cls, **kw):

http://git-wip-us.apache.org/repos/asf/allura/blob/fd618a7e/ForgeImporters/forgeimporters/trac/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/__init__.py b/ForgeImporters/forgeimporters/trac/__init__.py
index a1fbceb..12e677a 100644
--- a/ForgeImporters/forgeimporters/trac/__init__.py
+++ b/ForgeImporters/forgeimporters/trac/__init__.py
@@ -18,8 +18,10 @@
 from formencode import validators as fev
 import requests
 
+from allura.lib import validators
 
-class TracURLValidator(fev.URL):
+
+class TracURLValidator(validators.URL):
     not_empty = True
     messages = {
         'unavailable': 'This project is unavailable for import'

http://git-wip-us.apache.org/repos/asf/allura/blob/fd618a7e/ForgeSVN/forgesvn/widgets.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/widgets.py b/ForgeSVN/forgesvn/widgets.py
index d138cfd..c0c880f 100644
--- a/ForgeSVN/forgesvn/widgets.py
+++ b/ForgeSVN/forgesvn/widgets.py
@@ -17,20 +17,22 @@
 
 import re
 
-from formencode import validators as fev
-
 import ew as ew_core
 import ew.jinja2_ew as ew
 
+from allura.lib import validators
 from allura.lib.widgets.forms import ForgeForm
 
 
-class ValidateSvnUrl(fev.URL):
+class ValidateSvnUrl(validators.URL):
     url_re = re.compile(r'''
         ^(http|https|svn)://
         (?:[%:\w]*@)?                              # authenticator
+        (?:                                        # ip or domain
+        (?P<ip>(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|
         (?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\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]*)?


Mime
View raw message