Ticket #8630: __init__.py.patch
File __init__.py.patch, 1.9 KB (added by , 16 years ago) |
---|
-
contrib/comments/__init__.py
22 22 raise ImproperlyConfigured("The COMMENTS_APP setting refers to "\ 23 23 "a non-existing package.") 24 24 25 # Make sure some specific attributes exist inside that package.26 for attribute in REQUIRED_COMMENTS_APP_ATTRIBUTES:27 if not hasattr(package, attribute):28 raise ImproperlyConfigured("The COMMENTS_APP package %r does not "\29 "define the (required) %r function" % \30 (package, attribute))31 25 32 26 return package 33 27 … … 39 33 return getattr(settings, 'COMMENTS_APP', 'django.contrib.comments') 40 34 41 35 def get_model(): 42 from django.contrib.comments.models import Comment 43 return Comment 36 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_model"): 37 return get_comment_app().get_model() 38 else: 39 from django.contrib.comments.models import Comment 40 return Comment 44 41 45 42 def get_form(): 46 from django.contrib.comments.forms import CommentForm 47 return CommentForm 43 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_form"): 44 return get_comment_app().get_form() 45 else: 46 from django.contrib.comments.forms import CommentForm 47 return CommentForm 48 48 49 49 def get_form_target(): 50 return urlresolvers.reverse("django.contrib.comments.views.comments.post_comment") 50 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_form_target"): 51 return get_comment_app().get_form_target() 52 else: 53 return urlresolvers.reverse("django.contrib.comments.views.comments.post_comment") 51 54 52 55 def get_flag_url(comment): 53 56 """