def _getFile(self): context = getattr(self.context, 'aq_explicit', self.context) field = context.getField(self.fieldname) if field is None: raise pNotFound(self, self.fieldname, self.request) if not field.checkPermission('r', context): raise Unauthorized() return field.get(context)
def publishTraverse(self, request, name): if self.fieldname is None: # ../@@download/fieldname self.fieldname = name elif self.filename is None: # ../@@download/fieldname/filename self.filename = name else: raise pNotFound(self, name, request) return self