<s> from django . utils . translation import ugettext_lazy as _ <EOL> from django . contrib . sites . models import Site <EOL> from cms . models import Page <EOL> from cms . utils import permissions <EOL> from . wizards . wizard_pool import wizard_pool <EOL> from . wizards . wizard_base import Wizard <EOL> from . forms . wizards import CreateCMSPageForm , CreateCMSSubPageForm <EOL> class CMSPageWizard ( Wizard ) : <EOL> def user_has_add_permission ( self , user , page = None , ** kwargs ) : <EOL> if not page or not page . site_id : <EOL> site = Site . objects . get_current ( ) <EOL> else : <EOL> site = Site . objects . get ( pk = page . site_id ) <EOL> return permissions . has_page_add_permission ( <EOL> user , page , position = "<STR_LIT:right>" , site = site ) <EOL> class CMSSubPageWizard ( Wizard ) : <EOL> def user_has_add_permission ( self , user , page = None , ** kwargs ) : <EOL> if not page or page . application_urls : <EOL> return False <EOL> if not page . site_id : <EOL> site = Site . objects . get_current ( ) <EOL> else : <EOL> site = Site . objects . get ( pk = page . site_id ) <EOL> return permissions . has_page_add_permission ( <EOL> user , page , position = "<STR_LIT>" , site = site ) <EOL> cms_page_wizard = CMSPageWizard ( <EOL> title = _ ( u"<STR_LIT>" ) , <EOL> weight = <NUM_LIT:100> , <EOL> form = CreateCMSPageForm , <EOL> model = Page , <EOL> description = _ ( u"<STR_LIT>" ) <EOL> ) <EOL> cms_subpage_wizard = CMSSubPageWizard ( <EOL> title = _ ( u"<STR_LIT>" ) , <EOL> weight = <NUM_LIT> , <EOL> form = CreateCMSSubPageForm , <EOL> model = Page , <EOL> description = _ ( u"<STR_LIT>" ) <EOL> ) <EOL> wizard_pool . register ( cms_page_wizard ) <EOL> wizard_pool . register ( cms_subpage_wizard ) </s>
