Beispiel #1
0
class AppViewsHelper(object):
    implements(IHelper)

    def __init__(self, conversation_type):
        self.conversation_type = conversation_type

        self.vumi_helper = DjangoVumiApiHelper()
        self._app_helper = ApplicationHelper(
            conversation_type, self.vumi_helper)

        # Proxy methods from our helpers.
        generate_proxies(self, self._app_helper)
        generate_proxies(self, self.vumi_helper)

    def setup(self):
        # Create the things we need to create
        self.vumi_helper.setup()
        self.vumi_helper.make_django_user()

    def cleanup(self):
        return self.vumi_helper.cleanup()

    def get_new_view_url(self):
        return reverse('conversations:new_conversation')

    def get_conversation_helper(self, conversation):
        return ConversationViewHelper(self, conversation.key)

    def create_conversation_helper(self, *args, **kw):
        conversation = self.create_conversation(*args, **kw)
        return self.get_conversation_helper(conversation)

    def get_api_commands_sent(self):
        return base_utils.connection.get_commands()
Beispiel #2
0
class AppViewsHelper(object):
    implements(IHelper)

    def __init__(self, conversation_type):
        self.conversation_type = conversation_type

        self.vumi_helper = DjangoVumiApiHelper()
        self._app_helper = ApplicationHelper(conversation_type,
                                             self.vumi_helper)

        # Proxy methods from our helpers.
        generate_proxies(self, self._app_helper)
        generate_proxies(self, self.vumi_helper)

    def setup(self):
        # Create the things we need to create
        self.vumi_helper.setup()
        self.vumi_helper.make_django_user()

    def cleanup(self):
        return self.vumi_helper.cleanup()

    def get_new_view_url(self):
        return reverse('conversations:new_conversation')

    def get_conversation_helper(self, conversation):
        return ConversationViewHelper(self, conversation.key)

    def create_conversation_helper(self, *args, **kw):
        conversation = self.create_conversation(*args, **kw)
        return self.get_conversation_helper(conversation)

    def get_api_commands_sent(self):
        return base_utils.connection.get_commands()
Beispiel #3
0
class RouterViewsHelper(object):
    implements(IHelper)

    def __init__(self, router_type):
        self.router_type = router_type

        self.vumi_helper = DjangoVumiApiHelper()
        self._router_helper = RouterHelper(
            router_type, self.vumi_helper)

        # Proxy methods from our helpers.
        generate_proxies(self, self._router_helper)
        generate_proxies(self, self.vumi_helper)

    def setup(self):
        self.vumi_helper.setup()
        self.vumi_helper.make_django_user()

    def cleanup(self):
        return self.vumi_helper.cleanup()

    def get_new_view_url(self):
        return reverse('routers:new_router')

    def get_router_helper(self, router):
        return self.get_router_helper_by_key(router.key)

    def create_router_helper(self, *args, **kw):
        router = self.create_router(*args, **kw)
        return self.get_router_helper(router)

    def get_router_helper_by_key(self, router_key):
        return RouterViewHelper(self, router_key)

    def get_api_commands_sent(self):
        return base_utils.connection.get_commands()