Thread: SF.net SVN: fclient: [87] trunk/sandbox/fcp/fcp2_0_params.py
Status: Pre-Alpha
Brought to you by:
jurner
From: <ju...@us...> - 2008-01-30 13:21:04
|
Revision: 87 http://fclient.svn.sourceforge.net/fclient/?rev=87&view=rev Author: jurner Date: 2008-01-30 05:21:04 -0800 (Wed, 30 Jan 2008) Log Message: ----------- it is save now to pass any string as persistent user data Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-01-30 13:19:47 UTC (rev 86) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-01-30 13:21:04 UTC (rev 87) @@ -1,6 +1,7 @@ """Handling of additional message parameters""" import sys, os +import base64 #--> rel import hack class SysPathHack(object): @@ -65,7 +66,6 @@ ('FcPersistentUserData', validateString), ) - ISubType = 0 IInitTime = 1 IFilenameCollision = 2 @@ -91,19 +91,25 @@ if len(params) != len(FcParams) +1: return None + # validate and drop our magic string + uuid_ = params.pop(0) + result = validateUuid(uuid_) + if result is None: + return None + if result != MAGIC: + return None + for i, (paramName, paramValidator) in enumerate(FcParams): result = paramValidator(params[i]) if result is None: return None params[i] = result - # valiodate and drop our magic string - uuid_ = params.pop() - result = validateUuid(uuid_) - if result is None: + # decode user data + try: + params[IPersistentUserData] = base64.b64decode(params[IPersistentUserData]) + except TypeError: return None - if result != MAGIC: - return None return params @@ -117,7 +123,11 @@ params = [] for paramName, paramValidator in FcParams: params.append( str(msg[paramName]) ) - params.append(MAGIC) + + # encode user data + params[IPersistentUserData] = base64.b64encode(params[IPersistentUserData]) + params.insert(0, MAGIC) + return FcParamsSep.join(params) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2008-02-05 12:11:05
|
Revision: 145 http://fclient.svn.sourceforge.net/fclient/?rev=145&view=rev Author: jurner Date: 2008-02-05 04:11:06 -0800 (Tue, 05 Feb 2008) Log Message: ----------- added prefix param Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-05 12:10:33 UTC (rev 144) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-05 12:11:06 UTC (rev 145) @@ -132,16 +132,19 @@ -def newUuid(uuids=None): +def newUuid(prefix=None, uuids=None): """Creates a new unique identifier + @param prefix: (str) identifier prefix or None @param uuids: if desired any iterable containing uuids to enshure the identifier is unique in the iterable @return: (str) uuid """ - uuid_ = uuid.uuid_time() + if prefix is None: + prefix = '' + uuid_ = prefix + uuid.uuid_time() if uuids is not None: while uuid_ in uuids: - uuid_ = uuid_time() + uuid_ = prefix + uuid_time() return uuid_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2008-02-06 10:54:38
|
Revision: 159 http://fclient.svn.sourceforge.net/fclient/?rev=159&view=rev Author: jurner Date: 2008-02-06 02:54:42 -0800 (Wed, 06 Feb 2008) Log Message: ----------- adapt Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-06 10:54:27 UTC (rev 158) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-06 10:54:42 UTC (rev 159) @@ -60,7 +60,7 @@ MAGIC = '{8a7808d0-3934-465a-b1b4-b7150ed109a5}' # magic string to identify our requests FcParams = ( - ('FcSubType', validateInt), + ('FcType', validateInt), ('FcInitTime', validateFloat), # can not take it from uuid cos requests may be resend multiple times ('FcFilenameCollision', validateInt), ('FcPersistentUserData', validateString), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2008-02-06 11:13:02
|
Revision: 161 http://fclient.svn.sourceforge.net/fclient/?rev=161&view=rev Author: jurner Date: 2008-02-06 03:13:03 -0800 (Wed, 06 Feb 2008) Log Message: ----------- kicked out identifier prefixes. Use FcRequestType now Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-06 11:12:36 UTC (rev 160) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-06 11:13:03 UTC (rev 161) @@ -60,7 +60,7 @@ MAGIC = '{8a7808d0-3934-465a-b1b4-b7150ed109a5}' # magic string to identify our requests FcParams = ( - ('FcType', validateInt), + ('FcRequestType', validateInt), ('FcInitTime', validateFloat), # can not take it from uuid cos requests may be resend multiple times ('FcFilenameCollision', validateInt), ('FcPersistentUserData', validateString), @@ -132,19 +132,16 @@ -def newUuid(prefix=None, uuids=None): +def newUuid(uuids=None): """Creates a new unique identifier - @param prefix: (str) identifier prefix or None @param uuids: if desired any iterable containing uuids to enshure the identifier is unique in the iterable @return: (str) uuid """ - if prefix is None: - prefix = '' - uuid_ = prefix + uuid.uuid_time() + uuid_ = uuid.uuid_time() if uuids is not None: while uuid_ in uuids: - uuid_ = prefix + uuid_time() + uuid_ = uuid_time() return uuid_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2008-02-07 23:49:08
|
Revision: 170 http://fclient.svn.sourceforge.net/fclient/?rev=170&view=rev Author: jurner Date: 2008-02-07 15:49:12 -0800 (Thu, 07 Feb 2008) Log Message: ----------- docs Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-07 23:48:50 UTC (rev 169) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-07 23:49:12 UTC (rev 170) @@ -1,7 +1,8 @@ -"""Handling of additional message parameters""" +"""Handling of persistent request parameters""" import sys, os import base64 +import time #--> rel import hack class SysPathHack(object): @@ -131,7 +132,6 @@ return FcParamsSep.join(params) - def newUuid(uuids=None): """Creates a new unique identifier @param uuids: if desired any iterable containing uuids to enshure the identifier is unique in the iterable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ju...@us...> - 2008-02-08 13:35:19
|
Revision: 184 http://fclient.svn.sourceforge.net/fclient/?rev=184&view=rev Author: jurner Date: 2008-02-08 05:35:24 -0800 (Fri, 08 Feb 2008) Log Message: ----------- fix Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_params.py Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-08 13:35:03 UTC (rev 183) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-08 13:35:24 UTC (rev 184) @@ -67,7 +67,7 @@ ('FcPersistentUserData', validateString), ) -ISubType = 0 +IRequestType = 0 IInitTime = 1 IFilenameCollision = 2 IPersistentUserData = 3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |