Commits

Peter Sanchez  committed e55d481

Added support for callback scheme. Closes #5

  • Participants
  • Parent commits edfb6bf

Comments (0)

Files changed (2)

File djpubsubhubbub/config.py

     ''' Base config class to easily pass headers, etc.
     '''
     config = EasyConfig('djpubsubhubbub.Config', 'PUBSUBHUBBUB_CONFIG')
-    
+
     def get_extra_hub_headers(self, feed_url, hub_url):
         return self.config.get_object(
             'get_extra_hub_headers',
             str(Site.objects.get_current()),
             *(feed_url, hub_url)
         )
+
+    def get_default_callback_scheme(self, feed_url, hub_url):
+        return self.config.get_object(
+            'get_default_callback_scheme',
+            'http',
+            *(feed_url, hub_url)
+        )

File djpubsubhubbub/models.py

                 raise TypeError(
                     'callback cannot be None if there is not a reversible URL')
             else:
-                callback = 'http://{0}{1}'.format(
+                callback = '{0}://{1}{2}'.format(
+                    config.get_default_callback_scheme(topic, hub),
                     config.get_default_callback_host(topic, hub),
                     callback_path
                 )