def set(self, name, instance, value, **kwargs): """ """ if value and hasattr(value, 'get_size') and value.get_size() and not instance.isTemporary(): append(SetAction(instance, name, value, getattr(instance, '_v_renaming', False), getattr(instance, '_v_copying', False), **kwargs)) else: self._set(name, instance, value, **kwargs)
def cleanupInstance(self, instance, item=None, container=None): """Remove filesystem structure. """ if instance.isTemporary(): return pu = getToolByName(instance, 'portal_url') relative = pu.getRelativeContentPath(instance) path = os.path.join(self.getRootPath(), '/'.join(relative)) append(CleanupAction(instance, path))
def unset(self, name, instance, **kwargs): self.log(name, instance) try: ExternalStorage.unset(self, name, instance, **kwargs) except Unauthorized: sm = getSecurityManager() manager.id = sm.getUser().getId() newSecurityManager(instance.REQUEST, manager) ExternalStorage.unset(self, name, instance, **kwargs) setSecurityManager(sm) pass if instance.isTemporary(): return append(UnsetAction(instance, os.path.join(self.getRootPath(), self.getFilepath(instance, name))))