def canonical_url(self): if ISocialMedia.providedBy(self.context): return self.context.canonical_url return self.context.absolute_url()
def canonical_url(self): """Return canonical URL if available; otherwise, context URL.""" if ISocialMedia.providedBy(self.context): return self.context.canonical_url else: return self.context.absolute_url()
def test_socialmedia_behavior(self): self.assertTrue(ISocialMedia.providedBy(self.obj))