Esempio n. 1
0
    def login_event_handler(sender, user):
        '''
        This method itself does not do anything required by the login handler.
        All the hard work is done by the :meth:`_login_event_handler`. This is
        to ensure that downstream modules have the ability to modify the
        default behavior.

        .. note::

            It is possible that the cart module is available in the site
            packages and Tryton loads it, but the mdoule may not be installed
            in the specific database. To avoid false triggers, the code
            ensures that the model is in pool

        '''
        if not isinstance(current_app._get_current_object(), Nereid):
            # This is non nereid environment, just ignore
            return
        try:
            Cart = Pool().get('nereid.cart')
        except KeyError:
            current_app.logger.warning(
                "nereid-cart-b2c module installed but not in database")
        else:
            Cart._login_event_handler(user)
Esempio n. 2
0
    def login_event_handler(sender, user):
        '''
        This method itself does not do anything required by the login handler.
        All the hard work is done by the :meth:`_login_event_handler`. This is
        to ensure that downstream modules have the ability to modify the
        default behavior.

        .. note::

            It is possible that the cart module is available in the site
            packages and Tryton loads it, but the mdoule may not be installed
            in the specific database. To avoid false triggers, the code
            ensures that the model is in pool

        '''
        try:
            Cart = Pool().get('nereid.cart')
        except KeyError:
            current_app.logger.warning(
                "nereid-cart-b2c module installed but not in database"
            )
        else:
            Cart._login_event_handler(user)