def isAvailable(self): context = self.context if ISite.providedBy(context) or \ IUnremoveableContent.providedBy(context) or \ IRenameNotAllowed.providedBy(context): return False return super(DeleteContentAction, self).isAvailable()
def allowRename(self): if IRenameNotAllowed.providedBy(self.context): return False container = self.context.__parent__ return (IWriteContainer.providedBy(container) and not IContainerNamesContainer.providedBy(container) and canAccess(container, '__setitem__'))
def fields(self): if self.step.name != 'content' or \ not isinstance(self.step, ContentStep): return Fields() context = self.context if not ISite.providedBy(context): if IRenameNotAllowed.providedBy(context): return Fields() if not IContentNamesContainer.providedBy(context): location = context.__parent__ if IWriteContainer.providedBy(location) and \ not IContainerNamesContainer.providedBy(location): return Fields(IContentRenameForm) return Fields()
def __bind__(self, content, globalenviron, environ): clone = super(IdColumn, self).__bind__(content, globalenviron, environ) table = self.table copier = IObjectCopier(content, None) if copier is not None and copier.copyable() and \ canAccess(table.context, '__setitem__') and \ not IUncopyableContent.providedBy(content): copyable = True table.supportsCopy = True else: copyable = False moveable = False renameable = False deletable = False if not IUnremoveableContent.providedBy(content): mover = IObjectMover(content, None) if mover is not None and mover.moveable(): if not IUnpastableContent.providedBy(content): moveable = True table.supportsCut = True if not IRenameNotAllowed.providedBy(content): renameable = \ not IContainerNamesContainer.providedBy(self.context) if renameable: table.supportsRename = True if not IUnremoveableContent.providedBy(content) and \ checkPermission('zojax.DeleteContent', content): deletable = True table.supportsDelete = True clone.buttons = copyable or moveable or renameable or deletable return clone
def copyable(self): return not IRenameNotAllowed.providedBy(self.context) \ and not IUnremoveableContent.providedBy(self.context)