コード例 #1
0
    def _load(self):

        from woost.controllers.notifications import notify_user
        from woost.controllers.backoffice.basebackofficecontroller import \
            BaseBackOfficeController
        from woost.controllers.backoffice.itemcontroller import \
            ItemController

        from woost.extensions.mailer import (
            sendemailaction,
            createmailingaction,
            strings
        )
        from woost.extensions.mailer.mailing import Mailing, \
            RunningMailingError
        from woost.extensions.mailer.sendemailcontroller import \
            SendEmailController

        ItemController.send_email = SendEmailController

        Template.add_member(
            schema.Boolean(
                "per_user_customizable",
                default = False,
                listed_by_default = False
            )
        )
        Template.members_order.append("per_user_customizable")

        User.add_member(
            schema.Collection(
                "mailingLists",
                items = "woost.extensions.mailer.mailinglist.MailingList",
                bidirectional = True,
                listed_by_default = False
            )
        )

        @when(BaseBackOfficeController.exception_raised)
        def handle_exception_raised(event):                                                                                                                                                                   
            if isinstance(
                event.exception,
                RunningMailingError
            ):  
                notify_user(translations(event.exception), "error")
                raise cherrypy.HTTPRedirect(event.source.contextual_uri())
    
        # Disable interactive features from rendered pages when rendering
        # static content
        from woost.controllers.cmscontroller import CMSController
    
        @when(CMSController.producing_output)
        def disable_user_controls(event):
            if context.get("sending_email", False):
                event.output["show_user_controls"] = False
コード例 #2
0
    def _load(self):
        
        from woost.models import User
        from woost.extensions.signup import (
            signuppage,
            signupcontroller,
            strings
        )

        # Extend User model
        if not hasattr(User, "confirmed_email"):
            User.add_member(
                schema.Boolean(
                    "confirmed_email",
                    default = False,
                    Required = True
                )
            )
        
        self.install()
コード例 #3
0
#-*- coding: utf-8 -*-
"""

.. moduleauthor:: Pepe Osca <*****@*****.**>
"""
from cocktail.translations import translations
from cocktail import schema
from woost.models import User

translations.load_bundle("woost.extensions.identity.google.user")

User.add_member(
    schema.String("x_identity_google_user_id",
                  indexed=True,
                  unique=True,
                  editable=schema.NOT_EDITABLE,
                  listed_by_default=False,
                  member_group="administration"))