'Takes a list [(src,dest), (src,dest)], evaluates the template in the
context of other, then copies the result to self[dest]. This is on a
best-efforts basis. Some assignments can make no sense.'

def template_to_attribute(self, other, ops):

    if (not ops):
        return
    from calibre.ebooks.metadata.book.formatter import SafeFormat
    formatter = SafeFormat()
    for op in ops:
        try:
            src = op[0]
            dest = op[1]
            val = formatter.safe_format(src, other, 'PLUGBOARD    TEMPLATE    ERROR', other)
            if (dest == 'tags'):
                self.set(dest, [f.strip() for f in val.split(',') if f.strip()])
            elif (dest == 'authors'):
                self.set(dest, [f.strip() for f in val.split('&') if f.strip()])
            else:
                self.set(dest, val)
        except:
            if DEBUG:
                traceback.print_exc()
