import vobject from zope.interface import implements from Products.MetadataPortal.widgets import Default from Products.MetadataPortal.waramulib.interfaces import IWidget from Products.MetadataPortal.utils import translate, getLanguage class Authors(Default): """ authors widget """ implements(IWidget) def view(self, f, id, cls, w, tid, lang=None): """ author's vcard viewer """ r = u"" r += self._fieldLabel(cls, id, f.get('printable')) fval = self.context.get(f.get('name'), lang) for vcard in vobject.readComponents(fval): fn = vcard.n.value.given ln = vcard.n.value.family em = vcard.email.value orgs = ', '.join(vcard.org.value) r += '