[Python-modules-commits] [purl] 01/04: Import purl_1.2.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Mon Jan 25 11:58:57 UTC 2016
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository purl.
commit be75d65500bba52263bc7959135a3ba6bc441352
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Mon Jan 25 12:33:56 2016 +0100
Import purl_1.2.orig.tar.gz
---
PKG-INFO | 8 +++++++-
README.rst | 6 ++++++
purl.egg-info/PKG-INFO | 8 +++++++-
purl/__init__.py | 2 ++
purl/url.py | 20 ++++++++++++++++----
setup.py | 5 ++---
6 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 157087c..40bece1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: purl
-Version: 1.1
+Version: 1.2
Summary: An immutable URL class for easy URL-building and manipulation
Home-page: https://github.com/codeinthehole/purl
Author: David Winterbottom
@@ -176,6 +176,12 @@ Description: ================================
Changelog
---------
+ v1.2
+ ~~~~
+
+ * Support password-less URLs
+ * Allow slashes to be passed as path segments
+
v1.1
~~~~
diff --git a/README.rst b/README.rst
index 8901600..c1cdbe7 100644
--- a/README.rst
+++ b/README.rst
@@ -168,6 +168,12 @@ A wide variety of expansions are possible - refer to the RFC_ for more details.
Changelog
---------
+v1.2
+~~~~
+
+* Support password-less URLs
+* Allow slashes to be passed as path segments
+
v1.1
~~~~
diff --git a/purl.egg-info/PKG-INFO b/purl.egg-info/PKG-INFO
index 157087c..40bece1 100644
--- a/purl.egg-info/PKG-INFO
+++ b/purl.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: purl
-Version: 1.1
+Version: 1.2
Summary: An immutable URL class for easy URL-building and manipulation
Home-page: https://github.com/codeinthehole/purl
Author: David Winterbottom
@@ -176,6 +176,12 @@ Description: ================================
Changelog
---------
+ v1.2
+ ~~~~
+
+ * Support password-less URLs
+ * Allow slashes to be passed as path segments
+
v1.1
~~~~
diff --git a/purl/__init__.py b/purl/__init__.py
index 243fb25..f3d0b6d 100644
--- a/purl/__init__.py
+++ b/purl/__init__.py
@@ -1,2 +1,4 @@
from .url import URL # noqa
from .template import expand, Template # noqa
+
+__version__ = '1.2'
diff --git a/purl/url.py b/purl/url.py
index 88f422c..0dcc13b 100644
--- a/purl/url.py
+++ b/purl/url.py
@@ -63,6 +63,12 @@ def unicode_quote(string, safe='/'):
return quote(to_utf8(string), to_utf8(safe))
+def unicode_quote_path_segment(string):
+ if string is None:
+ return None
+ return quote(to_utf8(string), safe=to_utf8(""))
+
+
def unicode_unquote(string):
if string is None:
return None
@@ -96,14 +102,18 @@ def parse(url_str):
Extract all parts from a URL string and return them as a dictionary
"""
url_str = to_unicode(url_str)
-
result = urlparse(url_str)
netloc_parts = result.netloc.split('@')
if len(netloc_parts) == 1:
username = password = None
host = netloc_parts[0]
else:
- username, password = netloc_parts[0].split(':')
+ user_and_pass = netloc_parts[0].split(':')
+ if len(user_and_pass) == 2:
+ username, password = user_and_pass
+ elif len(user_and_pass) == 1:
+ username = user_and_pass[0]
+ password = None
host = netloc_parts[1]
if host and ':' in host:
@@ -211,6 +221,8 @@ class URL(object):
url = self._tuple
if url.username and url.password:
netloc = '%s:%s@%s' % (url.username, url.password, url.host)
+ elif url.username and not url.password:
+ netloc = '%s@%s' % (url.username, url.host)
else:
netloc = url.host
if url.port:
@@ -350,7 +362,7 @@ class URL(object):
"""
if value is not None:
segments = list(self.path_segments())
- segments[index] = value
+ segments[index] = unicode_quote_path_segment(value)
new_path = '/' + '/'.join(segments)
if self._tuple.path.endswith('/'):
new_path += '/'
@@ -367,7 +379,7 @@ class URL(object):
:param list value: the new path segments to use
"""
if value is not None:
- encoded_values = map(unicode_quote, value)
+ encoded_values = map(unicode_quote_path_segment, value)
new_path = '/' + '/'.join(encoded_values)
return URL._mutate(self, path=new_path)
parts = self._tuple.path.split('/')
diff --git a/setup.py b/setup.py
index d3904fe..e063516 100755
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
+import sys
-__version__ = '1.1'
+from purl import __version__
# Python 2/3 compatibility
-import sys
if sys.version_info[0] == 3:
def as_bytes(s):
return s
@@ -12,7 +12,6 @@ else:
def as_bytes(s):
return s.encode('utf8')
-
setup(
name='purl',
version=as_bytes(__version__),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/purl.git
More information about the Python-modules-commits
mailing list