def update(self): DisplayFieldWidget.update(self) content = self.form.getContentData().getContent() fileobj = self.component._field.get(content) if fileobj: if IFile.providedBy(fileobj): self.filename = fileobj.filename self.filesize = ISized(fileobj, None) self.url = get_absolute_url(content, self.request) self.download = "%s/++download++%s" % ( self.url, self.component.identifier)
def update(self): SchemaFieldWidget.update(self) if not self.form.ignoreContent: content = self.form.getContentData().getContent() fileobj = self.component._field.get(content) if fileobj: self.allow_action = True if IFile.providedBy(fileobj): self.filename = fileobj.filename self.filesize = ISized(fileobj, None) else: self.filename = _(u'download', default=u"Download") if ILocation.providedBy(content): self.url = get_absolute_url(content, self.request) self.download = "%s/++download++%s" % ( self.url, self.component.identifier)