Ejemplo n.º 1
0
    def __init__(self, parentIssue, commentelem, mapToBE={}, dontprocess=set(), mapFromBE=None):
        """Initialises a new comment taken from an XML backing. mapToBE should be a dictionary
        mapping the source XML element tags to BE element names and outputs if necessary i.e
        mapToBE={'xmltag':('befield', lambda xmlelem:xmlelem.text)}
        Current BE comment fields:

        uuid: UUID
        [Alt-id]: string
        [short-name]: string
        [In-reply-to]: UUID
        Author: string
        Date: datetime string
        Content-type: mimetype string
        body: string
        """
        if mapFromBE is None: mapFromBE={v[0]:(k, v[1]) for k, v in mapToBE.iteritems()}
        CommentBase.__init__(self, parentIssue)
        self.__element=commentelem
        self.__elementhash=0
        self.__mapToBE=mapToBE
        self.__dontprocess=dontprocess
        self.__mapFromBE=mapFromBE
        self.__setUUID()