How to use the masonite.view.View function in masonite

To help you get started, we’ve selected a few masonite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MasoniteFramework / masonite / tests / core / test_mail_log_drivers.py View on Github external
def setUp(self):
        self.app = App()
        self.app = self.app.bind('Container', self.app)

        self.app.bind('Test', object)
        self.app.bind('MailConfig', mail)
        viewClass = View(self.app)
        self.app.bind('ViewClass', viewClass)
        self.app.bind('View', viewClass.render)
        self.app.bind('MailLogDriver', MailLogDriver)
        self.app.bind('MailTerminalDriver', MailTerminalDriver)
github MasoniteFramework / masonite / tests / providers / test_statuscode_provider.py View on Github external
def setUp(self):
        self.app = App()
        self.app.bind('Container', self.app)
        self.app.bind('Request', Request(None).load_app(self.app).load_environ(generate_wsgi()))
        self.app.simple(Response)
        self.app.bind('Application', MockApplicationConfig)
        self.app.bind('ViewClass', View(self.app))
        self.app.bind('View', self.app.make('ViewClass').render)
github MasoniteFramework / masonite / tests / test_managers_mail_manager.py View on Github external
def setup_method(self):
        self.app = App()
        self.app = self.app.bind('Container', self.app)

        self.app.bind('Test', object)
        self.app.bind('MailSmtpDriver', object)
        self.app.bind('MailConfig', mail)
        self.app.bind('View', View(self.app).render)
        self.app.bind('ViewClass', View(self.app))
github MasoniteFramework / masonite / tests / core / test_auth.py View on Github external
def setUp(self):
        super().setUp()
        self.container = App()
        self.app = self.container
        self.app.bind('Container', self.app)
        view = View(self.container)
        self.request = Request(generate_wsgi())
        self.request.key(application.KEY)
        self.app.bind('Request', self.request)
        # self.auth = Auth(self.request, MockUser())
        self.container.bind('View', view.render)
        self.container.bind('ViewClass', view)
        self.app.bind('Application', application)
        self.app.bind('Auth', Auth)
        self.app.bind('AuthConfig', auth)
        self.app.bind('AuthManager', AuthManager)
        self.app.bind('AuthCookieDriver', AuthCookieDriver)
        self.app.bind('AuthJwtDriver', AuthJwtDriver)

        self.auth = self.app.make('Auth', User)
        self.request.load_app(self.app)
github MasoniteFramework / masonite / tests / test_managers_mail_manager.py View on Github external
def setup_method(self):
        self.app = App()
        self.app = self.app.bind('Container', self.app)

        self.app.bind('Test', object)
        self.app.bind('MailSmtpDriver', object)
        self.app.bind('MailConfig', mail)
        self.app.bind('View', View(self.app).render)
        self.app.bind('ViewClass', View(self.app))
github MasoniteFramework / masonite / tests / middleware / test_csrf_middleware.py View on Github external
def setUp(self):
        self.app = App()
        wsgi = generate_wsgi()
        self.request = Request(wsgi)
        self.route = Route().load_environ(wsgi)
        self.view = View(self.app)
        self.app.bind('Request', self.request)

        self.request = self.app.make('Request')
        self.app.bind('WebRoutes', [
            Get().route('/test/@route', None),
            Get().route('/test/10', None),
        ])
        self.request.container = self.app

        self.middleware = CsrfMiddleware(self.request, Csrf(self.request), self.view)
github MasoniteFramework / masonite / tests / core / test_mail_smtp_driver.py View on Github external
def setUp(self):
        self.app = App()
        self.app.bind('Container', self.app)

        self.app.bind('Test', object)
        self.app.bind('MailConfig', mail)
        self.app.bind('MailSmtpDriver', MailDriver)
        self.app.bind('MailMailgunDriver', Mailgun)
        viewClass = View(self.app)
        self.app.bind('ViewClass', viewClass)
        self.app.bind('View', viewClass.render)
github MasoniteFramework / masonite / masonite / commands / ModelCommand.py View on Github external
def handle(self):
        class_name = self.argument('name')
        view = View(App())
        class_directory = '{}{}.py'.format(self.base_directory, class_name)

        if not make_directory(class_directory):
            return self.error('{0} Already Exists!'.format(self.scaffold_name))

        with open(class_directory, 'w+') as f:
            if view.exists(self.template):
                f.write(
                    view.render(self.template, {
                                'class': class_name.split('/')[-1]}).rendered_template
                )
                self.info('{} Created Successfully!'.format(self.scaffold_name))

        if self.option('migration'):
            model_name = class_name.lower() + 's'
            self.call('migration', [
github MasoniteFramework / masonite / masonite / commands / BaseScaffoldCommand.py View on Github external
def handle(self):
        class_name = self.argument('name') + self.postfix
        view = View(App())
        class_directory = '{}{}{}{}'.format(
            self.base_directory, class_name, self.suffix, self.file_extension)

        if self.file_to_lower:
            class_directory = class_directory.lower()

        if not make_directory(class_directory):
            return self.error('{0} Already Exists!'.format(self.scaffold_name))

        with open(class_directory, 'w+') as f:
            if view.exists(self.template):
                f.write(
                    view.render(self.template, {
                                'class': self.prefix + class_name.split('/')[-1]}).rendered_template
                )
                self.info('{} Created Successfully!'.format(self.scaffold_name))
github MasoniteFramework / masonite / masonite / commands / ControllerCommand.py View on Github external
def handle(self):
        controller = self.argument('name')
        view = View(App())

        if not self.option('exact'):
            controller = controller + "Controller"

        if not make_directory('app/http/controllers/{0}.py'.format(controller)):
            return self.error('{0} Controller Exists!'.format(controller))

        with open('app/http/controllers/{0}.py'.format(controller), 'w+') as f:
            if view.exists('/masonite/snippets/scaffold/controller'):
                if self.option('resource'):
                    template = '/masonite/snippets/scaffold/controller_resource'
                else:
                    template = '/masonite/snippets/scaffold/controller'

                f.write(
                    view.render(