def getLicenseAndHolderFromObject(self, obj): """ Get the copyright holder and license from an object. """ if ILicensable.providedBy(obj): license = ILicense(obj) return license.getRightsHolder(), license.getRightsLicense() else: return None
def getLicenseFromObject(self, obj): """ Get the copyright license for an object. """ if ILicensable.providedBy(obj): license = ILicense(obj) return license.getRightsLicense() else: return None
def UpdateLicenseMetadataHandler(obj, event): """ Update License Metadata. """ if ILicensable.providedBy(event.object): license = ILicense(event.object) if hasattr(event.object.REQUEST, 'license') or hasattr(event.object.REQUEST, 'copyright_holder'): clutil = getUtility(IContentLicensingUtility) if clutil: clutil.setLicense(event.object, license) else: license.setRightsLicense(event.object.REQUEST['license'])
return False return True def has_contentlicensing_support(context): try: from Products.ContentLicensing.DublinCoreExtensions.interfaces \ import ILicensable except ImportError, e: return False from Products.ContentLicensing.utilities import interfaces as clifaces u = component.queryUtility(clifaces.IContentLicensingUtility) if u is None: return False return ILicensable.providedBy(context) def has_contenttagging_support(context): try: from lovely.tag import interfaces as tagifaces except ImportError, e: return False return component.queryUtility(tagifaces.ITaggingEngine) is not None class FeatureMixin(object): def has_contentrating_support(self): return has_contentrating_support(Acquisition.aq_inner(self.context)) def has_contentlicensing_support(self): return has_contentlicensing_support(Acquisition.aq_inner(self.context))
def isLicensable(self, obj): """ Is an object licensable? """ return ILicensable.providedBy(obj)