Thread: SF.net SVN: fclient: [581] trunk/fclient/src/fclient/lib/fcp2/client.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-11 19:37:03
|
Revision: 581
http://fclient.svn.sourceforge.net/fclient/?rev=581&view=rev
Author: jUrner
Date: 2008-07-11 12:37:10 -0700 (Fri, 11 Jul 2008)
Log Message:
-----------
pretend we can be certain..
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-11 19:36:40 UTC (rev 580)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-11 19:37:10 UTC (rev 581)
@@ -440,7 +440,7 @@
return nodeHello
- def isOpen(self):
+ def isConnected(self):
"""Checks if the clients connection is open
@return: (bool) True if so, False otherwise
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-12 11:09:58
|
Revision: 588
http://fclient.svn.sourceforge.net/fclient/?rev=588&view=rev
Author: jUrner
Date: 2008-07-12 04:10:03 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
comb over logging
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-12 11:09:38 UTC (rev 587)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-12 11:10:03 UTC (rev 588)
@@ -296,7 +296,7 @@
if event == self.events.Idle:
consts.ConstLogger.Event.log(consts.ConstDebugVerbosity.Chatty, consts.ConstLogMessages.EventTriggered + event.name)
else:
- consts.ConstLogger.Event.info(consts.ConstLogMessages.EventTriggered + event.name)
+ consts.ConstLogger.Event.log(consts.ConstDebugVerbosity.Message, consts.ConstLogMessages.EventTriggered + event.name)
def _close(self, msg):
@@ -316,12 +316,11 @@
self._ddaTests = []
self._requests = {}
-
- if msg is not None:
- self.events.ClientDisconnected(msg)
+
if self.ioHandler.isOpen():
self.ioHandler.close()
-
+ if msg is not None:
+ self.events.ClientDisconnected(msg)
def _finalizeRequest(self, msg, request, event):
"""Finalzes a request
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-12 11:11:45
|
Revision: 589
http://fclient.svn.sourceforge.net/fclient/?rev=589&view=rev
Author: jUrner
Date: 2008-07-12 04:11:55 -0700 (Sat, 12 Jul 2008)
Log Message:
-----------
ups, wrong debug level
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-12 11:10:03 UTC (rev 588)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-12 11:11:55 UTC (rev 589)
@@ -296,7 +296,7 @@
if event == self.events.Idle:
consts.ConstLogger.Event.log(consts.ConstDebugVerbosity.Chatty, consts.ConstLogMessages.EventTriggered + event.name)
else:
- consts.ConstLogger.Event.log(consts.ConstDebugVerbosity.Message, consts.ConstLogMessages.EventTriggered + event.name)
+ consts.ConstLogger.Event.debug(consts.ConstLogMessages.EventTriggered + event.name)
def _close(self, msg):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:51:02
|
Revision: 636
http://fclient.svn.sourceforge.net/fclient/?rev=636&view=rev
Author: jUrner
Date: 2008-07-15 16:51:04 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
some smaller fixes
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-15 23:49:14 UTC (rev 635)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-15 23:51:04 UTC (rev 636)
@@ -210,7 +210,6 @@
import atexit
import copy
-import logging
import random
import subprocess
import time
@@ -284,7 +283,8 @@
for event in self.events:
event += self._captureEvent
- self.setDebugVerbosity(consts.ConstDebugVerbosity.Warning if debugVerbosity is None else debugVerbosity)
+ if not debugVerbosity is None:
+ self.setDebugVerbosity(debugVerbosity)
atexit.register(self.close)
###############################################################
@@ -299,7 +299,7 @@
consts.ConstLogger.Event.debug(consts.ConstLogMessages.EventTriggered + event.name)
- def _close(self, msg):
+ def _close(self, msg=None):
"""Closes the client
@param msg: message to pass to the ClientDisconnected event or None to not inform listeners
@@ -413,7 +413,9 @@
"""Closes the client
@note: make shure to call close() when done with the client
"""
- msg = message.MsgClientDisconnected(
+ msg = None
+ if self.isConnected():
+ msg = message.MsgClientDisconnected(
DisconnectReason=consts.ConstDisconnectReason.Close,
)
self._close(msg)
@@ -538,8 +540,13 @@
@param debugVerbosity: L{consts.ConstDebugVerbosity}
"""
consts.ConstLogger.Client.setLevel(debugVerbosity)
-
+
+ def getNodeHelloMessage(self):
+ """returns the node hello message the client received or None if no message has arrived yet """
+ return self._nodeHelloMessage
+
+
def newIdentifier(self, identifiers=None):
"""Creates a new identifier to be used as request identifer or whatever
@param identifiers: if desired any iterable containing identifiers to enshure the identifier is unique within the iterable
@@ -852,7 +859,7 @@
return True
# check if it is one of our requests for key information
- if code == consts.ConstFetchError.TooBig and initialRequest['RequestType'] == consts.ConstRequestType.GetKeyInfo:
+ if code == consts.ConstFetchError.TooBig and initialRequest['RequestType'] & consts.ConstRequestType.GetKeyInfo:
initialRequest['MetadataContentType'] = msg.get('ExpectedMetadata.ContentType', '')
initialRequest['DataLength'] = msg.get('ExpectedDataLength', -1)
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Success
@@ -877,7 +884,6 @@
)
return True
- requestType = msg['RequestType']
if msg == message.MsgPersistentGet:
initialRequest = message.MsgClientGet()
elif msg == message.MsgPersistentPut:
@@ -1084,7 +1090,7 @@
insertURI = msg['InsertURI']
requestURI = msg['RequestURI']
- if initialRequest['RequestType'] == consts.ConstRequestType.GenerateUSKKeypair:
+ if initialRequest['RequestType'] & consts.ConstRequestType.GenerateUSKKeypair:
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
requestURI = key.KeyUSK(requestURI.keyData, docName=requestURI.docName)
@@ -1214,13 +1220,13 @@
#########################################################
def getConfig(self,
withCurrent=True,
- withDefaults=True,
- withExpertFlag=True,
- withForceWriteFlag=True,
- withSortOrder=True,
- withShortDescription=True,
- withLongDescription=True,
- withDataTypes=True,
+ withDefaults=False,
+ withExpertFlag=False,
+ withForceWriteFlag=False,
+ withSortOrder=False,
+ withShortDescription=False,
+ withLongDescription=False,
+ withDataTypes=False,
):
"""
@event: ConfigData(event, msg)
@@ -1546,9 +1552,9 @@
# find out wich message to use
if requestType & (consts.ConstRequestType.PutData | consts.ConstRequestType.PutFile | consts.ConstRequestType.PutRedirect):
msgClass = message.MsgClientPut
- elif requestType == consts.ConstRequestType.PutDir:
+ elif requestType & consts.ConstRequestType.PutDir:
msgClass = message.MsgClientPutDiskDir
- elif requestType == consts.ConstRequestType.PutMultiple:
+ elif requestType & consts.ConstRequestType.PutMultiple:
msgClass = message.MsgClientPutComplexDir
else:
raise ValueError('Unsupported request type')
@@ -1573,12 +1579,12 @@
msg[param] = value
if data is not None:
- if requestType != consts.ConstRequestType.PutData:
+ if not requestType & consts.ConstRequestType.PutData:
raise ValueError('Data can only be passed along with putData uploads')
msg.data = data
if items is not None:
- if requestType != consts.ConstRequestType.PutMultiple:
+ if not requestType & consts.ConstRequestType.PutMultiple:
raise ValueError('Items can only be passed along with PutMultiple uploads')
uploadTypeMapping = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|