Changeset 8573
- Timestamp:
- 08/26/08 01:58:43 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/comments/__init__.py
r8557 r8573 11 11 """ 12 12 # Make sure the app's in INSTALLED_APPS 13 comments_app = get attr(settings, 'COMMENTS_APP', 'django.contrib.comments')13 comments_app = get_comment_app_name() 14 14 if comments_app not in settings.INSTALLED_APPS: 15 15 raise ImproperlyConfigured("The COMMENTS_APP (%r) "\ … … 18 18 # Try to import the package 19 19 try: 20 package = __import__( settings.COMMENTS_APP, '', '', [''])20 package = __import__(comments_app, '', '', ['']) 21 21 except ImportError: 22 22 raise ImproperlyConfigured("The COMMENTS_APP setting refers to "\ … … 31 31 32 32 return package 33 34 def get_comment_app_name(): 35 """ 36 Returns the name of the comment app (either the setting value, if it 37 exists, or the default). 38 """ 39 return getattr(settings, 'COMMENTS_APP', 'django.contrib.comments') 33 40 34 41 def get_model(): … … 47 54 Get the URL for the "flag this comment" view. 48 55 """ 49 if settings.COMMENTS_APP!= __name__ and hasattr(get_comment_app(), "get_flag_url"):56 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_flag_url"): 50 57 return get_comment_app().get_flag_url(comment) 51 58 else: … … 56 63 Get the URL for the "delete this comment" view. 57 64 """ 58 if settings.COMMENTS_APP!= __name__ and hasattr(get_comment_app(), "get_delete_url"):65 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_delete_url"): 59 66 return get_comment_app().get_flag_url(get_delete_url) 60 67 else: … … 65 72 Get the URL for the "approve this comment from moderation" view. 66 73 """ 67 if settings.COMMENTS_APP!= __name__ and hasattr(get_comment_app(), "get_approve_url"):74 if get_comment_app_name() != __name__ and hasattr(get_comment_app(), "get_approve_url"): 68 75 return get_comment_app().get_approve_url(comment) 69 76 else: django/trunk/django/contrib/comments/templatetags/comments.py
r8557 r8573 82 82 is_public = True, 83 83 ) 84 if settings.COMMENTS_HIDE_REMOVED:84 if getattr(settings, 'COMMENTS_HIDE_REMOVED', True): 85 85 qs = qs.filter(is_removed=False) 86 86
