SF.net SVN: fclient: [135] trunk/sandbox/fcp/fcp2_0_client.py
Status: Pre-Alpha
Brought to you by:
jurner
From: <ju...@us...> - 2008-02-04 11:50:53
|
Revision: 135 http://fclient.svn.sourceforge.net/fclient/?rev=135&view=rev Author: jurner Date: 2008-02-04 03:50:30 -0800 (Mon, 04 Feb 2008) Log Message: ----------- fixes Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_client.py Modified: trunk/sandbox/fcp/fcp2_0_client.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_client.py 2008-02-04 11:49:28 UTC (rev 134) +++ trunk/sandbox/fcp/fcp2_0_client.py 2008-02-04 11:50:30 UTC (rev 135) @@ -113,6 +113,7 @@ from fcp2_0_config import Config from fcp2_0_message import Message import fcp2_0_params as FcParams +from fcp2_0_requests import Upload from fcp2_0_uri import Uri @@ -203,6 +204,7 @@ Message = Message FcParams = FcParams Uri = Uri + Upload = Upload @@ -339,7 +341,7 @@ fcParams[self.FcParams.IFilenameCollision], ) - # fix some Fcp inconsistencies ClientGet vs. PersistentGet + #FIX: remove Started param from PersistentGet / Put if msg.name == consts.Message.PersistentGet: del msg.params['Started'] #FIX: [0001965: Persistence vs PersistenceType] @@ -1462,7 +1464,7 @@ ## ClientPut related methods ## ######################################################## - def clientPutUpload(self, upload, userData=None, persistentUserData=''): + def putUpload(self, upload, userData=None, persistentUserData=''): msg = upload.getMessage(self.Message) if msg is None: @@ -1486,10 +1488,9 @@ ) if upload.keyType in (consts.KeyType.SSK, consts.KeyType.USK): - msg['FcRequestUri'] = upload.publicKey + msg['FcInsertUri'] = upload.privateKey #NOTE: the caller may use the 'FcInsertUri' member to store the private key - self.sendMessageEx(msg) return msg['Identifier'] @@ -1505,6 +1506,8 @@ msg = self.Message(consts.Message.ClientPut, URI=uri) for paramName, value in messageParams.items(): if value is not None: + if param == 'ContentType': + param = 'Metadata.ContentType' msg[paramName] = value if data is not None: msg.data = data @@ -1892,7 +1895,7 @@ if nodeHello is not None: - #for i in xrange(50): + #for i in xrange(10): # c.next() @@ -1970,7 +1973,13 @@ #persistence=c.Persistence.Reboot, ) - for i in xrange(100): + #u = c.Upload(c.consts.KeyType.USK, privateKey='USK@eeqMkAamPTUz983Sfr4Ce-ckPUwFgpuTwB~wce0BK3E,rMfH3jUrLRz23fltO-LGEEjnni9DwNKlPzWzaDqOTe8,AQACAAE/') + #u.addData('foo/0/', 'test1234') + #u.addData('bar', 'test12345678') + #u.addData('baz', 'test12345678') + #c.putUpload(u) + + for i in xrange(500): c.next() #c.removeRequest(myIdentifier) #for i in xrange(5): @@ -1982,9 +1991,12 @@ def testPutFile(): fpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test.jpg') - identifier = c.putFile( - fpath, - ) + #identifier = c.putFile( + # fpath, + # ) + u = c.Upload(c.consts.KeyType.CHK) + u.addFile('', fpath) + c.putUpload(u) for i in xrange(1000): c.next() @@ -1993,6 +2005,7 @@ # c.next() #testPutFile() + def testConfigData(): @@ -2027,7 +2040,7 @@ for i in xrange(10): c.next() - #testConfigData() + testConfigData() @@ -2049,6 +2062,7 @@ def cb(event, msg): print msg.pprint() + pass c.events.KeypairGenerated += cb c.generateKeypair('SSK@') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |