Commits

don...@bigass.local  committed b6cff13

Implement lookup to find the Address of an Actor with a well-known name.

  • Participants
  • Parent commits b4666f8

Comments (0)

Files changed (2)

File pyact/actor.py

     def __init__(self, actor):
         self.__actor = weakref.ref(actor)
 
+    @staticmethod
+    def lookup(name):
+        """Return the Address of an Actor given the actor_id as a string.
+        """
+        return Actor.all_actors[name].address
+
     @property
     def _actor(self):
         """This will be inaccessible to Python code in the C implementation.

File pyact/wsgiapp.py

                 'receive': self.receive,
                 'cooperate': self.cooperate,
                 'sleep': self.sleep,
+                'lookup': actor.Address.lookup,
                 'spawn_code': spawn_code}, vars(self)
         except:
             traceback.print_exc()