Skip to content

Commit

Permalink
location quote disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
dem214 committed Feb 6, 2021
1 parent 63eee8a commit f682ce4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="xspf-lib",
version="0.1.3",
version="0.2.0",
author="Dzmitry Izaitka",
author_email="[email protected]",
description="Library for work with xspf format",
Expand Down
5 changes: 5 additions & 0 deletions test/test_uri.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import xspf_lib

def test_youtube_case():
t = xspf_lib.Track('https://youtube.com/watch?v=[id]')
assert t.xml_string() == '<track><location>https://youtube.com/watch?v=[id]</location></track>'
6 changes: 3 additions & 3 deletions xspf_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


def quote(value: str) -> str:
return urlparse.quote(value, safe='/:')
return value


class XMLAble(ABC):
Expand Down Expand Up @@ -186,7 +186,7 @@ def xml_elements(self):
"""Create generator of xml representation."""
if self.location is not None:
el = ET.Element('location')
el.text = str(urlparse.quote(self.location, safe='/:'))
el.text = str(quote(self.location))
yield el
if self.identifier is not None:
el = ET.Element('identifier')
Expand Down Expand Up @@ -535,7 +535,7 @@ def add_locations(self):
if self.entity.location is not None:
for loc in self.entity.location:
ET.SubElement(self.xml_element, 'location').text = \
str(urlparse.quote(loc, safe='/:'))
str(quote(loc))

def add_identifiers(self):
if self.entity.identifier is not None:
Expand Down

0 comments on commit f682ce4

Please sign in to comment.