<s> from django . http import Http404 <EOL> from django . template import RequestContext <EOL> from django . shortcuts import render_to_response <EOL> from django . views . decorators . cache import cache_page <EOL> from brubeck . articles . models import Article <EOL> from brubeck . mapping . models import Map , Place <EOL> def detail ( request , slug = None , mode = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> map = Map . objects . get ( slug = slug ) <EOL> except Map . DoesNotExist : <EOL> if mode == '<STR_LIT>' : <EOL> return None <EOL> elif mode == '<STR_LIT>' : <EOL> raise Http404 <EOL> else : <EOL> raise StandardError ( "<STR_LIT>" ) <EOL> mpl_list = map . mapplacelink_set . all ( ) <EOL> latitudes = [ ] <EOL> longitudes = [ ] <EOL> for mpl in mpl_list : <EOL> latitudes . append ( float ( mpl . place . point . get_y ( ) ) ) <EOL> longitudes . append ( float ( mpl . place . point . get_x ( ) ) ) <EOL> extents = { <EOL> '<STR_LIT>' : min ( latitudes ) , <EOL> '<STR_LIT>' : max ( latitudes ) , <EOL> '<STR_LIT>' : min ( longitudes ) , <EOL> '<STR_LIT>' : max ( longitudes ) <EOL> } <EOL> page = { <EOL> '<STR_LIT>' : extents , <EOL> '<STR_LIT>' : map , <EOL> '<STR_LIT>' : mpl_list , <EOL> } <EOL> if mode == '<STR_LIT>' : <EOL> return page <EOL> elif mode == '<STR_LIT>' : <EOL> return render_to_response ( '<STR_LIT>' , page , context_instance = RequestContext ( request ) ) <EOL> else : <EOL> raise StandardError ( "<STR_LIT>" ) </s>
