Example #1
0
def execute(state, args):
    key = args.file[0]

    data = state.get(key)
    if not data:
        raise Exception('Unable to find "%s"' % (args.file, ))

    dm.add_last(
        data, 'TIME-REPORT', '%s %s %s %s' %
        (args.time, args.user, args.spent[0], args.remaining[0]))

    state.save(key)
Example #2
0
def execute(state, args):
    key = args.file[0]

    data = state.get(key)
    if not data:
        raise Exception('Unable to find "%s"' % (args.file,))

    dm.add_last(data,
                'TIME-REPORT',
                '%s %s %s %s' % (args.time,
                                 args.user,
                                 args.spent[0],
                                 args.remaining[0]))

    state.save(key)
Example #3
0
def _link(state, args, data, path):
    other = state.get_by_path(path)
    other_id = dm.get(other, 'ID')
    if not other_id:
        logging.warn('Can not link to "%s", no id.', path)
        return

    key = args.type.upper()

    if not key in data:
        data[key] = []

    name = dm.get(data, 'NAME', path)
    for line in data[key]:
        if line.startswith(other_id):
            logging.info('Already linked to "%s"', dm.get(other, 'NAME', '?'))
            return

    dm.add_last(data, key, '%s %s' % (other_id, name))

    logging.info('Linking "%s" to "%s"', dm.get(data, 'NAME', '?'),
                 dm.get(other, 'NAME', '?'))
Example #4
0
def _link(state, args, data, path):
    other = state.get_by_path(path)
    other_id = dm.get(other, 'ID')
    if not other_id:
        logging.warn('Can not link to "%s", no id.', path)
        return

    key = args.type.upper()

    if not key in data:
        data[key] = []

    name = dm.get(data, 'NAME', path)
    for line in data[key]:
        if line.startswith(other_id):
            logging.info('Already linked to "%s"',
                         dm.get(other, 'NAME', '?'))
            return

    dm.add_last(data, key, '%s %s' % (other_id, name))

    logging.info('Linking "%s" to "%s"',
                 dm.get(data, 'NAME', '?'),
                 dm.get(other, 'NAME', '?'))