<s> from __future__ import unicode_literals <EOL> from django . contrib . sitemaps import Sitemap <EOL> from django . contrib . sites . models import Site <EOL> from mezzanine . conf import settings <EOL> from mezzanine . core . models import Displayable <EOL> from mezzanine . utils . sites import current_site_id <EOL> blog_installed = "<STR_LIT>" in settings . INSTALLED_APPS <EOL> if blog_installed : <EOL> from mezzanine . blog . models import BlogPost <EOL> class DisplayableSitemap ( Sitemap ) : <EOL> """<STR_LIT>""" <EOL> def items ( self ) : <EOL> """<STR_LIT>""" <EOL> return list ( Displayable . objects . url_map ( in_sitemap = True ) . values ( ) ) <EOL> def lastmod ( self , obj ) : <EOL> if blog_installed and isinstance ( obj , BlogPost ) : <EOL> return obj . updated or obj . publish_date <EOL> def get_urls ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ "<STR_LIT>" ] = Site . objects . get ( id = current_site_id ( ) ) <EOL> return super ( DisplayableSitemap , self ) . get_urls ( ** kwargs ) </s>
