def _handleNewLocation(event): if len(event.results)==0: newLocation = model.Location(event.params["name"]) event.addResult("actor", newLocation) else: newLocation = model.Location(event.params["name"], event.results["actor"]["uuid"]) state.add_actor(newLocation) return event
def _handleNewUser(event): # I'm not totally sure why the second case here exists. When will newUser # get called and there's already a user object in the results dict? if len(event.results)==0: newUser = model.User(event.params["name"],\ email=event.params["email"]) event.addResult("actor", newUser) else: newUser = model.User(event.params["name"], event.results["actor"]["uuid"]) # Make sure to do this for new locations, too. state.add_actor(newUser) return event