<s> from django . conf import settings <EOL> from django . contrib . sitemaps import Sitemap <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . translation import get_language , activate <EOL> from oscar . core . loading import get_model <EOL> Product = get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> Category = get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> """<STR_LIT>""" <EOL> class I18nSitemap ( Sitemap ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , language ) : <EOL> self . language = language <EOL> self . original_language = get_language ( ) <EOL> def get_obj_location ( self , obj ) : <EOL> return obj . get_absolute_url ( ) <EOL> def location ( self , obj ) : <EOL> activate ( self . language ) <EOL> location = self . get_obj_location ( obj ) <EOL> activate ( self . original_language ) <EOL> return location <EOL> class StaticSitemap ( I18nSitemap ) : <EOL> def items ( self ) : <EOL> return [ '<STR_LIT>' , ] <EOL> def get_obj_location ( self , obj ) : <EOL> return reverse ( obj ) <EOL> class ProductSitemap ( I18nSitemap ) : <EOL> def items ( self ) : <EOL> return Product . browsable . all ( ) <EOL> class CategorySitemap ( I18nSitemap ) : <EOL> def items ( self ) : <EOL> return Category . objects . all ( ) <EOL> language_neutral_sitemaps = { <EOL> '<STR_LIT>' : StaticSitemap , <EOL> '<STR_LIT>' : ProductSitemap , <EOL> '<STR_LIT>' : CategorySitemap , <EOL> } <EOL> base_sitemaps = { } <EOL> for language , __ in settings . LANGUAGES : <EOL> for name , sitemap_class in language_neutral_sitemaps . items ( ) : <EOL> base_sitemaps [ '<STR_LIT>' . format ( name , language ) ] = sitemap_class ( language ) </s>
