def push_profile_to_node(node_uri): """Send an updated copy of our profile to a specified node.""" print "push_profile_to_node %s" % node_uri node_uri = hashless(node_uri) node = None user = None try: user = User.objects.get(pk=settings.OUR_USER_PK) node = Node.objects.get(uri=node_uri) except User.DoesNotExist: raise Exception, "The main user MUST exist!" except Node.DoesNotExist: raise Exception, "The node requested does not exist." # TODO: Granularized Privacy message = SylphMessage(node_uri) message.set_post('dispatch', 'user_push') message.add(user) response = send(message) if not response.has_errors(): node.just_failed(save=True) print "User profile push failed." # TODO: Error log return node.just_pushed_to(save=True)