relative_uri property
changed miniuri/miniuri.py changed test_miniuri.py
This commit is contained in:
parent
440be5802b
commit
f04c7ff72d
2 changed files with 4 additions and 3 deletions
|
|
@ -22,7 +22,7 @@ class Uri( object ):
|
|||
def uri( self ):
|
||||
"""build and return uri from attributes"""
|
||||
scheme = self.scheme + '://' if self.scheme else ''
|
||||
return ''.join([scheme, self.authority, self.not_authority])
|
||||
return ''.join([scheme, self.authority, self.relative_uri])
|
||||
|
||||
@uri.setter
|
||||
def uri( self, uri ):
|
||||
|
|
@ -69,7 +69,7 @@ class Uri( object ):
|
|||
self.hostname, self.port = self.hostname.split( ':' )
|
||||
|
||||
@property
|
||||
def not_authority(self):
|
||||
def relative_uri(self):
|
||||
"""return everything that isn't part of the authority."""
|
||||
path = query = fragment = ''
|
||||
if self.path: path = self.path
|
||||
|
|
|
|||
|
|
@ -149,4 +149,5 @@ class TestMiniUri(TestCase):
|
|||
self.assertEqual(self.u.fragment, '6')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#6')
|
||||
|
||||
|
||||
def test_relative_uri(self):
|
||||
self.assertEqual(self.u.relative_uri, '/path/filename.jpg?p=2#5')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue