def prepare_oembed_consumer(self): # Support for additional endpoints additional_endpoints = { key: oembed.OEmbedEndpoint(entry['endpoint'], entry['urlpatterns']) for key, entry in self.getConfig('endpoints', []).items() } supported_endpoints = ENDPOINTS.copy() supported_endpoints.update(additional_endpoints) # Configure for supported endpoints allowed_endpoints = self.getConfig('allowed_endpoints', supported_endpoints.keys()) consumer = oembed.OEmbedConsumer() [consumer.addEndpoint(v) for k, v in supported_endpoints.items() if k in allowed_endpoints] return consumer