SF.net SVN: fclient:[695] trunk/fclient/src/fclient/lib/fcp2/client.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-20 11:50:41
|
Revision: 695
http://fclient.svn.sourceforge.net/fclient/?rev=695&view=rev
Author: jUrner
Date: 2008-07-20 11:49:59 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
bit of an overkill when handling filename collisions
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/client.py
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 11:46:26 UTC (rev 694)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 11:49:59 UTC (rev 695)
@@ -350,7 +350,7 @@
del self._requests[request['Identifier']]
- def _registerRequest(self,
+ def registerRequest(self,
msg,
requestType,
userData=None,
@@ -672,21 +672,17 @@
# handle filename collisions
elif code == consts.ConstProtocolError.DiskTargetExists:
- handleCollision = initialRequest.get('HandleFilenameCollision', None)
- if handleCollision is not None: # looks like one of our requests
- collisionHandled = initialRequest.get('FilenameCollisionHandled', None)
- if collisionHandled is not None: # one more hint that it is one of our requests
- if handleCollision:
- # rename file and resend request
- initialRequest['FilenameCollisionHandled'] = True
- filename = initialRequest['Filename']
- newFilename = namespace.unique_filename(filename, extensions=1, ispostfixed=collisionHandled)
- initialRequest['Filename'] = newFilename
- initialRequest['Modified'] = {consts.ConstRequestModified.Filename: filename}
- initialRequest.updatePersistentParams()
- self.sendMessage(initialRequest)
- self.events.RequestModified(initialRequest)
- return True
+ if initialRequest['HandleFilenameCollision']:
+ # rename file and resend request
+ filename = initialRequest['Filename']
+ newFilename = namespace.unique_filename(filename, extensions=1, ispostfixed=initialRequest['FilenameCollisionHandled'])
+ initialRequest['FilenameCollisionHandled'] = True
+ initialRequest['Filename'] = newFilename
+ initialRequest['Modified'] = {consts.ConstRequestModified.Filename: filename}
+ initialRequest.updatePersistentParams()
+ self.sendMessage(initialRequest)
+ self.events.RequestModified(initialRequest)
+ return True
# handle plugin related request failures
elif code == consts.ConstProtocolError.NoSuchPlugin or code == consts.ConstProtocolError.AccessDenied:
@@ -1297,7 +1293,7 @@
if value is not None:
msg[paramName] = value
- self._registerRequest(
+ self.registerRequest(
msg,
requestType,
handleFilenameCollision=handleFilenameCollision,
@@ -1527,7 +1523,7 @@
URI=uri,
DontPoll=dontPoll,
)
- self._registerRequest(msg, consts.ConstRequestType.SubscribeUSK)
+ self.registerRequest(msg, consts.ConstRequestType.SubscribeUSK)
msg['RequestStatus'] |= consts.ConstRequestStatus.Completed
self.sendMessage(msg)
return msg['Identifier']
@@ -1680,7 +1676,7 @@
msg.data = data
# finally
- self._registerRequest(
+ self.registerRequest(
msg,
requestType,
persistentUserData=persistentUserData,
@@ -2156,7 +2152,7 @@
PluginName=pluginName,
Detailed=detailed,
)
- self._registerRequest(msg, consts.ConstRequestType.PluginInfo)
+ self.registerRequest(msg, consts.ConstRequestType.PluginInfo)
self.sendMessage(msg)
return msg['Identifier']
@@ -2206,7 +2202,7 @@
requestType = consts.ConstRequestType.GenerateSSKKeypair if keypairType == consts.ConstKeyType.SSK else consts.ConstRequestType.GenerateUSKKeypair
msg = message.MsgGenerateSSK()
- self._registerRequest(msg, requestType)
+ self.registerRequest(msg, requestType)
self.sendMessage(msg)
return msg['Identifier']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|