<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 <EOL> from django . template import 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> 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 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>
