SF.net SVN: fclient: [333] trunk/sandbox/fcp2/message.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-03-07 09:54:26
|
Revision: 333
http://fclient.svn.sourceforge.net/fclient/?rev=333&view=rev
Author: jUrner
Date: 2008-03-07 01:54:27 -0800 (Fri, 07 Mar 2008)
Log Message:
-----------
adapt to Fc prefix has gone
Modified Paths:
--------------
trunk/sandbox/fcp2/message.py
Modified: trunk/sandbox/fcp2/message.py
===================================================================
--- trunk/sandbox/fcp2/message.py 2008-03-07 09:54:21 UTC (rev 332)
+++ trunk/sandbox/fcp2/message.py 2008-03-07 09:54:27 UTC (rev 333)
@@ -23,6 +23,12 @@
#********************************************************************************
#
#********************************************************************************
+class PrivateParamName(str):
+ """Helper class to mark a message parameter as private to the package"""
+
+#********************************************************************************
+#
+#********************************************************************************
class Message(object):
"""Class wrapping a Fcp message
@@ -44,10 +50,14 @@
@ivar params: (dict) message params
"""
- # we add a few private params...
- ParamPrefixPrivate = 'Fc' # params prefixed with this are skipped when generating the message
+ @classmethod
+ def privateParamName(klass, name):
+ """Returns a message param name that is marked as being private to the package
+ @return: (L{PrivateParamName])
+ """
+ return PrivateParamName(name)
-
+
def __init__(self, name, data=None, **params):
"""
@param name: messge name
@@ -81,7 +91,7 @@
paramTypes = types.MessageParamTypes.get(self.name, None)
for param, value in self.params.items():
- if param.startswith(self.ParamPrefixPrivate):
+ if isinstance(param, PrivateParamName):
continue
# convert python to fcp value if necessary
@@ -106,7 +116,7 @@
paramTypes = types.MessageParamTypes.get(self.name, None)
for param, value in self.params.items():
- if param.startswith(self.ParamPrefixPrivate):
+ if isinstance(param, PrivateParamName):
continue
# convert python to fcp value if necessary
@@ -125,6 +135,4 @@
return '\n'.join(out)
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|