def get_form(): """ Return the form to use for commenting. """ global form_class from fluent_comments import appsettings if form_class is None: if appsettings.FLUENT_COMMENTS_FORM_CLASS: from fluent_comments.utils import import_symbol form_class = import_symbol(appsettings.FLUENT_COMMENTS_FORM_CLASS, 'FLUENT_COMMENTS_FORM_CLASS') else: from fluent_comments.forms import FluentCommentForm form_class = FluentCommentForm return form_class
def test_import_symbol_errors(self): self.assertRaises(ImproperlyConfigured, lambda: import_symbol("fluent_comments.FooBar", "FOOBAR")) self.assertRaises(ImproperlyConfigured, lambda: import_symbol("fluent_comments_na.FooBar", "FOOBAR"))