Commits

Ginés Martínez Sánchez committed 741bd9a Draft

refactoring sockjs work done until now

  • Participants
  • Parent commits 38c2534

Comments (0)

Files changed (2)

ginsfsm/protocols/sockjs/server/basehandler.py

 
 from pyramid.response import Response
 
+from ginsfsm.protocols.sockjs.server.session import ConnectionInfo
 from ginsfsm.protocols.wsgi.webob.async_response import AsyncResponse
 
 #----------------------------------------------------------------#
             except:
                 pass
 
+    def get_conn_info(self):
+        """Return `ConnectionInfo` object from current transport"""
+        return ConnectionInfo(
+            self.request.remote_addr,  # remote_ip
+            self.request.cookies,
+            self.request.params,  # arguments
+            self.request.headers,
+            self.request.path
+        )
+
 
 class PreflightHandler(BaseHandler):
     """CORS preflight handler"""

ginsfsm/protocols/sockjs/server/c_xhr.py

 from ginsfsm.gobj import GObj
 from ginsfsm.protocols.sockjs.server import proto
 from ginsfsm.protocols.sockjs.server.basehandler import PreflightHandler
-from ginsfsm.protocols.sockjs.server.session import ConnectionInfo
 
 #----------------------------------------------------------------#
 #                   GXhrSend GClass
             self.response.content_type = 'application/javascript'
             self.response.charset = 'UTF-8'
 
-            print "======> SEND_PACK SYNC", message
             self.write(message + '\n')
             self.flush()
             self.send_complete()
             self.session.remove_handler(self)
             self.session = None
 
-    def get_conn_info(self):
-        """Return `ConnectionInfo` object from current transport"""
-        return ConnectionInfo(
-            self.request.remote_addr,  # remote_ip
-            self.request.cookies,
-            self.request.params,  # arguments
-            self.request.headers,
-            self.request.path
-        )
 
 #----------------------------------------------------------------#
 #                   GXhrStreaming GClass
         # parece como un flow control
 
         try:
-            print "======> SEND_PACK AAAASYNC", message
             self.notify_sent(len(message))
             self.write(message + '\n')
             self.flush(callback=self.send_complete)
             self.session.remove_handler(self)
             self.session = None
         self.context.gaplic.add_callback(self.safe_finish)
-
-    def get_conn_info(self):
-        """Return `ConnectionInfo` object from current transport"""
-        return ConnectionInfo(
-            self.request.remote_addr,  # remote_ip
-            self.request.cookies,
-            self.request.params,  # arguments
-            self.request.headers,
-            self.request.path
-        )