You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2018/01/26 10:50:19 UTC
svn commit: r1822269 - /comdev/reporter.apache.org/trunk/scripts/urlutils.py
Author: sebb
Date: Fri Jan 26 10:50:18 2018
New Revision: 1822269
URL: http://svn.apache.org/viewvc?rev=1822269&view=rev
Log:
Allow use with nameless URLs
Modified:
comdev/reporter.apache.org/trunk/scripts/urlutils.py
Modified: comdev/reporter.apache.org/trunk/scripts/urlutils.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/urlutils.py?rev=1822269&r1=1822268&r2=1822269&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/urlutils.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/urlutils.py Fri Jan 26 10:50:18 2018
@@ -184,6 +184,10 @@ class UrlCache(object):
"""
if name == None:
name = basename(urlparse(url).path)
+ if name == '': # no-name URL
+ import re
+ # convert URL to file name: replace all but alphanum and '-'
+ name = re.sub(r'[^\w]+','_',url)
target=self.__getname(name)
fileTime = self.__file_mtime(target)
if useFileModTime:
@@ -256,6 +260,7 @@ class UrlCache(object):
if __name__ == '__main__':
fc2 = UrlCache(cachedir=None,interval=0, debug=True)
+ fc2.get("https://www.apache.org/", name=None, encoding='utf-8')
fc2.get("https://svn.apache.org/repos/asf/subversion/README","README", encoding='utf-8')
fc = UrlCache(cachedir=None,interval=10, silent=True, debug=True)
GIT='https://raw.githubusercontent.com/apache/infrastructure-puppet/deployment/modules/subversion_server/files/authorization/'