def available(self): if not (IViewView.providedBy(self.view) or IFolderContentsView.providedBy(self.view)): return False # Context could be a default page. We want the canonical object # instead. context = aq_inner(self.context) pcs = getMultiAdapter( (context, self.request), name='plone_context_state') canonical = pcs.canonical_object() if not IQuickUploadCapable.providedBy(canonical): return False elif IQuickUploadNotCapable.providedBy(canonical): return False elif not self.pm.checkPermission('Add portal content', canonical): return False elif isTemporary(canonical): return False upload_portal_type = self.data.upload_portal_type if (upload_portal_type and upload_portal_type != 'auto' and upload_portal_type not in [ t.id for t in canonical.getAllowedTypes() ]): return False else: return True
def __call__(self): if IQuickUploadNotCapable.providedBy(self.context): raise Unauthorized # disable diazo themes self.request.response.setHeader('X-Theme-Disabled', 'True') return self.template()
def available(self): if not (IViewView.providedBy(self.view) \ or IFolderContentsView.providedBy(self.view)): return False context = aq_inner(self.context) if not IQuickUploadCapable.providedBy(context): return False elif IQuickUploadNotCapable.providedBy(context): return False elif not self.pm.checkPermission('Add portal content', context): return False elif isTemporary(context): return False upload_portal_type = self.data.upload_portal_type if (upload_portal_type and upload_portal_type != 'auto' and upload_portal_type not in [t.id for t in self.context.getAllowedTypes()]): return False else: return True
def can_upload(self): context = aq_inner(self.context) mtool = getToolByName(self.context, "portal_membership") if not IQuickUploadCapable.providedBy(context): return False elif IQuickUploadNotCapable.providedBy(context): return False elif not mtool.checkPermission("Add portal content", context): return False elif isTemporary(context): return False upload_portal_type = "auto" if ( upload_portal_type and upload_portal_type != "auto" and upload_portal_type not in [t.id for t in self.context.getAllowedTypes()] ): return False else: return True
def __call__(self): if IQuickUploadNotCapable.providedBy(self.context): raise Unauthorized return self.template()
def available(self): return not IQuickUploadNotCapable.providedBy(self.context)