Exemplo n.º 1
0
    def collectLogInfo(self, *junk, **args):
        """ Collect Record fields' info interactively
        'data' in the args must be a bytes which can
        be decoded using utf8, binary data that is
        not utf8 encoded, is not applicable.
        """
        data = args.pop('data')
        subject = args.pop('subject')
        binary = args.pop('binary')

        # read subject and data from editor
        if binary:
            iData = b'\n# Binary data is provided, therefore only the first\n'
            iData += b'# line will be used for subject, empty message aborts.\n'
        elif subject:
            iData = subject.encode()
            if data:
                iData += b'\n\n' + data
        else:
            iData = b''
        oData = editContent(iData).decode()
        msgLines = oData.split('\n\n')
        subject = msgLines.pop(0).strip()
        if not binary:  # accept data from editor only for non-binary
            data = '\n\n'.join(msgLines)

        # empty subject, abort
        assert subject != '', "aborting due to empty subject"

        # read other info
        requests = self.makeRequests(**args)
        i = interact.readMany(requests)
        time = i['time']
        scene = i['scene']
        people = i['people']
        tag = i['tag']

        return dict(subject=subject,
                    time=time,
                    scene=scene,
                    people=people,
                    tag=tag,
                    data=data,
                    binary=binary)
Exemplo n.º 2
0
    def collectLogInfo(self, *junk, **args):
        """ Collect Record fields' info interactively
        'data' in the args must be a bytes which can
        be decoded using utf8, binary data that is
        not utf8 encoded, is not applicable.
        """
        data     = args.pop('data')
        subject  = args.pop('subject')
        binary   = args.pop('binary')

        # read subject and data from editor
        if binary:
            iData =  b'\n# Binary data is provided, therefore only the first\n'
            iData += b'# line will be used for subject, empty message aborts.\n'
        elif subject:
            iData = subject.encode()
            if data:
                iData += b'\n\n' + data
        else:
            iData = b''
        oData    = editContent(iData).decode()
        msgLines = oData.split('\n\n')
        subject  = msgLines.pop(0).strip()
        if not binary:  # accept data from editor only for non-binary
            data = '\n\n'.join(msgLines)

        # empty subject, abort
        assert subject != '', "aborting due to empty subject"

        # read other info
        requests = self.makeRequests(**args)
        i        = interact.readMany(requests)
        time     =  i['time']
        scene    =  i['scene']
        people   =  i['people']
        tag      =  i['tag']

        return dict(subject=subject, time=time, scene=scene,
                      people=people, tag=tag, data=data, binary=binary)
Exemplo n.º 3
0
    def collectLogInfo(self, *junk, **args):
        """ Collect Record fields' info interactively
        'data' in the args must be a bytes which can
        be decoded using utf8, binary data that is
        not utf8 encoded, is not applicable.
        """
        comment = args.pop('comment')
        desc    = args.pop('desc')

        # read desc and comment from editor
        if desc:
            iData = desc.encode()
            if comment:
                iData += b'\n\n' + comment
        else:
            iData = b''
        oData    = editContent(iData).decode()
        msgLines = oData.split('\n\n')
        desc     = msgLines.pop(0).strip()
        comment  = '\n\n'.join(msgLines)

        # empty desc, abort
        assert desc != '', "aborting due to empty desc"

        # read other info
        requests = self.makeRequests(**args)
        i        = interact.readMany(requests)
        time     = i['time']
        host     = i['host']
        protocol = i['protocol']
        port     = i['port']
        user     = i['user']
        password = i['password']

        return dict(desc=desc, time=time, host=host, protocol=protocol,
                      port=port, user=user, password=password, comment=comment)