(self, buf=None, lineLength=75, validate=True, behavior=None)
Serialize to buf if it exists, otherwise return a string.

        Use self.behavior.serialize if behavior exists.
Serialize to buf if it exists, otherwise return a string.
Serialize to buf if it exists otherwise return a string .
def serialize(self, buf=None, lineLength=75, validate=True, behavior=None):
        """
        Serialize to buf if it exists, otherwise return a string.

        Use self.behavior.serialize if behavior exists.
        """
        if not behavior:
            behavior = self.behavior

        if behavior:
            if DEBUG:
                logger.debug("serializing {0!s} with behavior {1!s}".format(self.name, behavior))
            return behavior.serialize(self, buf, lineLength, validate)
        else:
            if DEBUG:
                logger.debug("serializing {0!s} without behavior".format(self.name))
            return defaultSerialize(self, buf, lineLength)
def serialize ( self , buf = None , lineLength = 75 , validate = True , behavior = None ) : if not behavior : behavior = self . behavior if behavior : if DEBUG : logger . debug ( "serializing {0!s} with behavior {1!s}" . format ( self . name , behavior ) ) return behavior . serialize ( self , buf , lineLength , validate ) else : if DEBUG : logger . debug ( "serializing {0!s} without behavior" . format ( self . name ) ) return defaultSerialize ( self , buf , lineLength )