#1346310: Add `Secure` attribute to cookie when navigating on https
fromcubicwebimportValidationErrorfromcubicweb.selectorsimportis_instancefromcubicweb.serverimporthookclassSourceHook(hook.Hook):__abstract__=Truecategory='cw.sources'classSourceAddedOp(hook.Operation):defprecommit_event(self):self.session.repo.add_source(self.entity)classSourceAddedHook(SourceHook):__regid__='cw.sources.added'__select__=SourceHook.__select__&is_instance('CWSource')events=('after_add_entity',)def__call__(self):SourceAddedOp(self._cw,entity=self.entity)classSourceRemovedOp(hook.Operation):defprecommit_event(self):self.session.repo.remove_source(self.uri)classSourceRemovedHook(SourceHook):__regid__='cw.sources.removed'__select__=SourceHook.__select__&is_instance('CWSource')events=('before_delete_entity',)def__call__(self):ifself.entity.name=='system':raiseValidationError(self.entity.eid,{None:'cant remove system source'})SourceRemovedOp(self._cw,uri=self.entity.name)