def publish(self, topic, obj, reference_message=None):
        """
        Sends an object out over the pubsub connection, properly formatted,
        and conforming to the protocol.  Handles pickling for the wire, etc.
        This method should *not* be subclassed.
        """
        logging.debug("Publishing topic (%s): \n%s" % (topic, obj))
        e = Event(
            data=obj,
            type=topic,
        )
        if hasattr(obj, "sender"):
            e.sender = obj.sender

        if reference_message:
            original_incoming_event_hash = None
            if hasattr(reference_message, "original_incoming_event_hash"):
                original_incoming_event_hash = reference_message.original_incoming_event_hash
            elif hasattr(reference_message, "source") and hasattr(reference_message.source, "hash"):
                original_incoming_event_hash = reference_message.source.hash
            elif hasattr(reference_message, "source") and hasattr(reference_message.source, "original_incoming_event_hash"):
                original_incoming_event_hash = reference_message.source.original_incoming_event_hash
            elif hasattr(reference_message, "hash"):
                original_incoming_event_hash = reference_message.hash
            if original_incoming_event_hash:
                e.original_incoming_event_hash = original_incoming_event_hash

        return self.publish_to_backend(
            self._localize_topic(topic),
            self.encrypt(e)
        )
def publish ( self , topic , obj , reference_message = None ) : logging . debug ( "Publishing topic (%s): \n%s" % ( topic , obj ) ) e = Event ( data = obj , type = topic , ) if hasattr ( obj , "sender" ) : e . sender = obj . sender if reference_message : original_incoming_event_hash = None if hasattr ( reference_message , "original_incoming_event_hash" ) : original_incoming_event_hash = reference_message . original_incoming_event_hash elif hasattr ( reference_message , "source" ) and hasattr ( reference_message . source , "hash" ) : original_incoming_event_hash = reference_message . source . hash elif hasattr ( reference_message , "source" ) and hasattr ( reference_message . source , "original_incoming_event_hash" ) : original_incoming_event_hash = reference_message . source . original_incoming_event_hash elif hasattr ( reference_message , "hash" ) : original_incoming_event_hash = reference_message . hash if original_incoming_event_hash : e . original_incoming_event_hash = original_incoming_event_hash return self . publish_to_backend ( self . _localize_topic ( topic ) , self . encrypt ( e ) )
Sends an object out over the pubsub connection, properly formatted,
        and conforming to the protocol.  Handles pickling for the wire, etc.
        This method should *not* be subclassed.