Commits

Ginés Martínez Sánchez committed 295818c Draft

developing examples inter_event

  • Participants
  • Parent commits ff1bff6

Comments (0)

Files changed (2)

File ginsfsm/gaplic.py

 
         self.start_up()
 
+    def __str__(self):
+        return self.name
+
+    def __repr__(self):
+        return "%r %r" % (self.name, self.roles)
+
     def start_up(self):
         """ Initialization zone.
         """
 
         if self.router_enabled:
             self.start_up_router()
-        self.logger and self.logger.info('GAplic (%r) initiated' % self.name)
+        self.logger and self.logger.info('GAplic %r initiated' % self)
 
     def start_up_router(self, pyramid_router_url=None, pyramid_root=None):
         from ginsfsm.router import GRouter

File ginsfsm/router.py

 
         if not route.identity_ack:
             # TODO: improve sending identity card with timeouts
-            self.router.send_identity_card(route.write)
+            self.router.send_identity_card(route)
             return
 
         if route.cur_pending_event:
     # send our identity card if iam client
     # we only send the identity card in static routes!
     if not websocket.config.iam_server:
-        self.send_identity_card(websocket.write)
+        self.send_identity_card(websocket.route)
 
 
 def ac_on_close(self, event):
     if trace_router:
         prefix = '%s <== %s' % (
             registry.my_gaplic_name,
-            this_route.route_ref,
+            this_route,
         )
         self.trace_intra_event(prefix, intra_event)
 
                 exc_info=True,
             )
 
-    def send_identity_card(self, write):
+    def send_identity_card(self, route):
         my_gaplic_name = self.registry.my_gaplic_name
         my_roles = self.registry.my_roles
 
         )
 
         if self.config.trace_router:
-            prefix = '%s ==> %s' % (my_gaplic_name, '')
+            prefix = '%s ==> %s' % (my_gaplic_name, route)
             self.trace_intra_event(prefix, idc)
         x = idc.toJSON()
-        write(x)
+        route.write(x)
 
     def find_local_router(self):
         if self.local_router: