from zope.interface import implements from zope.component import getUtility from Products.MetadataPortal.interfaces import iMDPortal, IWaramu from Products.MetadataPortal.waramulib.interfaces import IAttachable from Products.MetadataPortal.utils import translate, getLanguage class Attachments(object): implements(IAttachable) def __init__(self, context): self.context = context def view(self): r = u'' % ('attachments', translate(self, 'Files', getLanguage(self.context.request))) if self.context.getNOfAttachments() > 0: pr = getUtility(iMDPortal, context=self.context) w = getUtility(IWaramu, context=self.context).__of__(pr) loa = w.listAttachments(self.context.getId()) ats = loa.items() ats.sort() r += '