Skip to content

Commit cdd633c

Browse files
committedMar 3, 2014
small changes in Add: function to assemble a uri
1 parent f2fc055 commit cdd633c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎bots/botslib.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -774,11 +774,13 @@ class Uri(object):
774774
'''
775775
def __init__(self, **kw):
776776
self._uri = dict(scheme='',username='',password='',hostname='',port='', path='', filename='',query={},fragment='')
777-
self.__call__(**kw)
778-
def __call__( self, **kw):
777+
self.update(**kw)
778+
def update( self, **kw):
779779
self._uri.update(**kw)
780-
def __str__(self, **kw):
781-
self.__call__(**kw)
780+
def uri(self, **kw):
781+
self.update(**kw)
782+
return self.__str__()
783+
def __str__(self):
782784
scheme = self._uri['scheme'] + ':' if self._uri['scheme'] else ''
783785
password = ':' + self._uri['password'] if self._uri['password'] else ''
784786
userinfo = self._uri['username'] + password + '@' if self._uri['username'] else ''
@@ -790,7 +792,6 @@ def __str__(self, **kw):
790792
else:
791793
terug = authority
792794
return scheme + terug
793-
uri = __str__
794795
#**********************************************************/**
795796
#************** Exception classes ***************************
796797
#**********************************************************/**

‎uniturl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def testempty(self):
4242
#~ self.assertEqual('scheme://username:password@hostname:80/path1/path2/filename',str(Uri(scheme='scheme',username='username',password='password',hostname='hostname',port=80,path='path1/path2',filename= 'filename')),'basis')
4343

4444
def testcalls(self):
45-
self.assertEqual('scheme:/path1/path2/filename',Uri(scheme='scheme',path='/path1/path2',filename='filename').uri(),'')
45+
self.assertEqual('scheme:/path1/path2/filename2',Uri(scheme='scheme',path='/path1/path2',filename='filename').uri(filename='filename2'),'')
4646

4747

4848
if __name__ == '__main__':

0 commit comments

Comments
 (0)
Please sign in to comment.