<s> import warnings <EOL> from django . conf import settings <EOL> from django . core import urlresolvers <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from django . contrib . comments . models import Comment <EOL> from django . contrib . comments . forms import CommentForm <EOL> from django . utils . importlib import import_module <EOL> warnings . warn ( "<STR_LIT>" , PendingDeprecationWarning ) <EOL> DEFAULT_COMMENTS_APP = '<STR_LIT>' <EOL> def get_comment_app ( ) : <EOL> """<STR_LIT>""" <EOL> comments_app = get_comment_app_name ( ) <EOL> if comments_app not in settings . INSTALLED_APPS : <EOL> raise ImproperlyConfigured ( "<STR_LIT>" "<STR_LIT>" % settings . COMMENTS_APP ) <EOL> try : <EOL> package = import_module ( comments_app ) <EOL> except ImportError as e : <EOL> raise ImproperlyConfigured ( "<STR_LIT>" "<STR_LIT>" % e ) <EOL> return package <EOL> def get_comment_app_name ( ) : <EOL> """<STR_LIT>""" <EOL> return getattr ( settings , '<STR_LIT>' , DEFAULT_COMMENTS_APP ) <EOL> def get_model ( ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_model ( ) <EOL> else : <EOL> return Comment <EOL> def get_form ( ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_form ( ) <EOL> else : <EOL> return CommentForm <EOL> def get_form_target ( ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_form_target ( ) <EOL> else : <EOL> return urlresolvers . reverse ( "<STR_LIT>" ) <EOL> def get_flag_url ( comment ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_flag_url ( comment ) <EOL> else : <EOL> return urlresolvers . reverse ( "<STR_LIT>" , <EOL> args = ( comment . id , ) ) <EOL> def get_delete_url ( comment ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_delete_url ( comment ) <EOL> else : <EOL> return urlresolvers . reverse ( "<STR_LIT>" , <EOL> args = ( comment . id , ) ) <EOL> def get_approve_url ( comment ) : <EOL> """<STR_LIT>""" <EOL> if get_comment_app_name ( ) != DEFAULT_COMMENTS_APP and hasattr ( get_comment_app ( ) , "<STR_LIT>" ) : <EOL> return get_comment_app ( ) . get_approve_url ( comment ) <EOL> else : <EOL> return urlresolvers . reverse ( "<STR_LIT>" , <EOL> args = ( comment . id , ) ) </s>
