<s> import sys <EOL> from django import forms <EOL> from django . http import HttpResponse , HttpResponseRedirect <EOL> from django . core . urlresolvers import get_resolver <EOL> from django . shortcuts import render_to_response , render <EOL> from django . template import Context , RequestContext , TemplateDoesNotExist <EOL> from django . views . debug import technical_500_response <EOL> from django . views . generic . create_update import create_object <EOL> from regressiontests . views import BrokenException , except_args <EOL> from models import Article <EOL> def index_page ( request ) : <EOL> """<STR_LIT>""" <EOL> return HttpResponse ( '<STR_LIT>' ) <EOL> def custom_create ( request ) : <EOL> """<STR_LIT>""" <EOL> class SlugChangingArticleForm ( forms . ModelForm ) : <EOL> """<STR_LIT>""" <EOL> class Meta : <EOL> model = Article <EOL> def save ( self , * args , ** kwargs ) : <EOL> self . instance . slug = '<STR_LIT>' <EOL> return super ( SlugChangingArticleForm , self ) . save ( * args , ** kwargs ) <EOL> return create_object ( request , <EOL> post_save_redirect = '<STR_LIT>' , <EOL> form_class = SlugChangingArticleForm ) <EOL> def raises ( request ) : <EOL> def callable ( ) : <EOL> raise Exception <EOL> try : <EOL> raise Exception <EOL> except Exception : <EOL> return technical_500_response ( request , * sys . exc_info ( ) ) <EOL> def raises404 ( request ) : <EOL> resolver = get_resolver ( None ) <EOL> resolver . resolve ( '<STR_LIT>' ) <EOL> def redirect ( request ) : <EOL> """<STR_LIT>""" <EOL> return HttpResponseRedirect ( "<STR_LIT>" ) <EOL> def view_exception ( request , n ) : <EOL> raise BrokenException ( except_args [ int ( n ) ] ) <EOL> def template_exception ( request , n ) : <EOL> return render_to_response ( '<STR_LIT>' , <EOL> { '<STR_LIT>' : except_args [ int ( n ) ] } ) <EOL> def render_to_response_view ( request ) : <EOL> return render_to_response ( '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } ) <EOL> def render_to_response_view_with_request_context ( request ) : <EOL> return render_to_response ( '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , context_instance = RequestContext ( request ) ) <EOL> def render_to_response_view_with_mimetype ( request ) : <EOL> return render_to_response ( '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , mimetype = '<STR_LIT>' ) <EOL> def render_view ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } ) <EOL> def render_view_with_base_context ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , context_instance = Context ( ) ) <EOL> def render_view_with_content_type ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , content_type = '<STR_LIT>' ) <EOL> def render_view_with_status ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , status = <NUM_LIT> ) <EOL> def render_view_with_current_app ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , current_app = "<STR_LIT>" ) <EOL> def render_view_with_current_app_conflict ( request ) : <EOL> return render ( request , '<STR_LIT>' , { <EOL> '<STR_LIT:foo>' : '<STR_LIT>' , <EOL> '<STR_LIT:bar>' : '<STR_LIT>' , <EOL> } , current_app = "<STR_LIT>" , context_instance = RequestContext ( request ) ) <EOL> def raises_template_does_not_exist ( request ) : <EOL> try : <EOL> return render_to_response ( '<STR_LIT>' ) <EOL> except TemplateDoesNotExist : <EOL> return technical_500_response ( request , * sys . exc_info ( ) ) </s>
