def inherited_resources(self):

        if self.inherit_resources and self.parent is None:
            catalog = Document.get_instance(
                qname = "woost.extensions.ecommerce.catalog_page"
            )

            if catalog:
                for resource in catalog.inherited_resources:
                    yield resource

                for resource in catalog.branch_resources:
                    yield resource        
        else:
            for resource in Publishable.inherited_resources.__get__(self):
                yield resource
Exemple #2
0
    def _install(self):

        from woost.models import (
            extension_translations,
            User,
            Controller,
            Document,
            StandardPage,
            Template,
            EmailTemplate
        )
        from woost.extensions.signup.signuppage import SignUpPage

        signup_controller = self._create_asset(
            Controller,
            "signup_controller",
            python_name =
                "woost.extensions.signup.signupcontroller.SignUpController",
            title = extension_translations
        )
        
        signup_confirmation_controller = self._create_asset(
            Controller,
            "signup_confirmation_controller",
            python_name = 
                "woost.extensions.signup.signupconfirmationcontroller."
                "SignUpConfirmationController",
            title = extension_translations
        )

        signup_view = self._create_asset(
            Template,
            "signup_template",
            identifier = "woost.extensions.signup.SignUpView",
            engine = u"cocktail",
            title = extension_translations
        )

        signup_confirmation_view = self._create_asset(
            Template,
            "signup_confirmation_template",
            identifier = u"woost.extensions.signup.SignUpConfirmationView",
            engine = u"cocktail",
            title = extension_translations
        )

        confirmation_email_template = self._create_asset(
            EmailTemplate,
            "signup_confirmation_email_template",
            python_name =
                u"woost.extensions.signup.signupconfirmationemailtemplate."
                "SignUpConfirmationEmailTemplate",
            template_engine = u"mako",
            sender = User.require_instance(qname="woost.administrator").email,
            receivers = u"[user.email]",
            title = extension_translations,
            subject = extension_translations,
            body = extension_translations
        )

        confirmation_target = self._create_asset(
            StandardPage,
            "signup_confirmation_target",
            title = extension_translations,
            controller = signup_confirmation_controller,
            template = signup_confirmation_view,
            hidden = True
        )

        signup_page = self._create_asset(
            SignUpPage,
            "signup_page",
            title = extension_translations,
            user_type = User,
            confirmation_target = confirmation_target,
            parent = Document.get_instance(qname="woost.home"),
        )

        signup_page.children.append(confirmation_target)