[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pyamf-commits
Subject:    [pyamf-commits] r93 - branches/remoting-2/pyamf
From:       pyamf-commits () collab ! com (pyamf-commits () collab ! com)
Date:       2007-10-30 8:35:51
Message-ID: 20071030073544.6E6347BC00C () mail ! collab ! com
[Download RAW message or body]

Author: nick
Date: 2007-10-30 08:35:44 +0100 (Tue, 30 Oct 2007)
New Revision: 93

Modified:
   branches/remoting-2/pyamf/amf3.py
   branches/remoting-2/pyamf/messaging.py
   branches/remoting-2/pyamf/util.py
Log:
Simplified messages hierarchy

Modified: branches/remoting-2/pyamf/amf3.py
===================================================================
--- branches/remoting-2/pyamf/amf3.py	2007-10-29 16:21:31 UTC (rev 92)
+++ branches/remoting-2/pyamf/amf3.py	2007-10-30 07:35:44 UTC (rev 93)
@@ -695,24 +695,25 @@
     messageId = None
     timeToLive = None
     timestamp = None
+    
+    def __repr__(self):
+        m = '<%s ' % self.__class__.__name__
 
-class AcknowledgeMessage(AbstractMessage):
+        for k, v in self.__dict__.iteritems():
+            m += ' %s=%s' % (k, v)
+
+        return m + " />"
+
+class AsyncMessage(AbstractMessage):
     correlationId = None
 
-    def __repr__(self):
-        return "<RemotingMessage correlationId=%s messageId=%s clientId=%s \
                destination=%s timeToLive=%s timestamp=%s />" % (
-                self.correlationId, self.messageId, self.clientId,
-                self.destination, self.timeToLive, self.timestamp)
+class AcknowledgeMessage(AsyncMessage):
+    pass
 
-class CommandMessage(AbstractMessage):
+class CommandMessage(AsyncMessage):
     operation = None
-    correlationId = None
     messageRefType = None
 
-    def __repr__(self):
-        return "<CommandMessage correlationId=%s operation=%s messageRefType=%s>" % \
                (
-            self.correlationId, self.operation, self.messageRefType)
-
 class ErrorMessage(AbstractMessage):
     extendedData = {}
     faultCode = None
@@ -720,20 +721,10 @@
     faultString = None
     rootCause = {}
 
-    def __repr__(self):
-        return "<ErrorMessage faultCode=%s faultString=%s messageId=%s clientId=%s \
                destination=%s timeToLive=%s timestamp=%s operation=%s source=%s>" % \
                (
-                self.faultCode, self.faultString, self.messageId, self.clientId, \
                self.destination,
-                self.timeToLive, self.timestamp, self.operation, self.source)
-
 class RemotingMessage(AbstractMessage):
     operation = None
     source = None
 
-    def __repr__(self):
-        return "<RemotingMessage messageId=%s clientId=%s destination=%s \
                timeToLive=%s timestamp=%s operation=%s source=%s/>" % (
-                self.messageId, self.clientId, self.destination,
-                self.timeToLive, self.timestamp, self.operation, self.source)
-
 pyamf.register_class(RemotingMessage, 'flex.messaging.messages.RemotingMessage')
 pyamf.register_class(ErrorMessage, 'flex.messaging.messages.ErrorMessage')
 pyamf.register_class(CommandMessage, 'flex.messaging.messages.CommandMessage')

Modified: branches/remoting-2/pyamf/messaging.py
===================================================================
--- branches/remoting-2/pyamf/messaging.py	2007-10-29 16:21:31 UTC (rev 92)
+++ branches/remoting-2/pyamf/messaging.py	2007-10-30 07:35:44 UTC (rev 93)
@@ -83,6 +83,8 @@
         return "<Body target=%(target)s response=%(response)s>\n  %(data)s\n \
</Body>" % (self.__dict__)  
 def _get_amf_decoder(version):
+    global pyamf
+
     if version == pyamf.AMF0:
         import pyamf.amf0
 

Modified: branches/remoting-2/pyamf/util.py
===================================================================
--- branches/remoting-2/pyamf/util.py	2007-10-29 16:21:31 UTC (rev 92)
+++ branches/remoting-2/pyamf/util.py	2007-10-30 07:35:44 UTC (rev 93)
@@ -142,7 +142,7 @@
 def hexdump(data):
     import string
 
-    hex = ascii = bug = ""
+    hex = ascii = buf = ""
     index = 0
 
     for c in data:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic