SF.net SVN: fclient: [73] trunk/fclient/fclient_lib/fcp/fcp2_0.py
Status: Pre-Alpha
Brought to you by:
jurner
From: <jU...@us...> - 2007-11-13 20:57:12
|
Revision: 73 http://fclient.svn.sourceforge.net/fclient/?rev=73&view=rev Author: jUrner Date: 2007-11-13 12:57:13 -0800 (Tue, 13 Nov 2007) Log Message: ----------- more methods, more flags Modified Paths: -------------- trunk/fclient/fclient_lib/fcp/fcp2_0.py Modified: trunk/fclient/fclient_lib/fcp/fcp2_0.py =================================================================== --- trunk/fclient/fclient_lib/fcp/fcp2_0.py 2007-11-12 11:33:36 UTC (rev 72) +++ trunk/fclient/fclient_lib/fcp/fcp2_0.py 2007-11-13 20:57:13 UTC (rev 73) @@ -613,7 +613,7 @@ """All known peer note types""" Private = '1' - class Priorities: + class Priority: """All priorities supported by the client""" Maximum = '0' Interactive = '1' @@ -623,9 +623,7 @@ Prefetch = '5' Minimum = '6' - PriorityMin = Minimum - PriorityDefault = Bulk - + class ProtocolError(Exception): """All protocol errors supported by the client""" @@ -1200,7 +1198,7 @@ ## ########################################################## #TODO: not complete yet - def clientGetFile(self, uri, filename, identifier=None, clientToken=None): + def clientGetFile(self, uri, filename, identifier=None, clientToken=None, priorityClass=None): """ """ if identifier is None: @@ -1225,14 +1223,17 @@ #BinaryBlob='false', Filename=filename, ) - if clientToken is not None: + if clientToken is not None: msg['ClientToken'] = clientToken + if priorityClass is not None: + msg['PriorityClass'] = priorityClass + self.sendMessageEx(msg) return identifier - def clientRequestInfo(self, uri, identifier=None, clientToken=None, **params): + def clientRequestInfo(self, uri, identifier=None, clientToken=None, priorityClass=None, **params): """Requests info about a file @param uri: uri of the file to request info about @param identifier: request identifier or None to let the method create one. If an identifier is passed, it has to be @@ -1262,10 +1263,11 @@ Verbosity='1', **params ) - if clientToken is not None: msg['ClientToken'] = clientToken - + if priorityClass is not None: + msg['PriorityClass'] = priorityClass + self.sendMessageEx(msg) return identifier @@ -1284,6 +1286,24 @@ return identifier.startswith(self.IdentifierPrefix.ClientRequestInfo) + def modifyPersistantRequest(self, identifier, global_=False, priorityClass=None): + """Modifies a request + @param identifier: identifier of the request + @param global: (bool) required. Is the request global or local? + @param clientToken: new client token or None + @param priorityClass: new priority or None + """ + msg = self.Message( + self.Message.ModifyPersistentRequest, + Identifier=identifier, + Global=self.fcpBool(global_), + ) + if priorityClass is not None: + msg['PriorityClass'] = priorityClass + self.sendMessageEx(msg) + + + def removePersistentRequest(self, identifier, global_=False): """Removes a request @param identifier: (str) identifier of the request to remove This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |