Ejemplo n.º 1
0
        def run(self, *args):
            """Runs the management script.
            If ``self.env`` is not defined, it will import it from
            ``current_app``.
            """

            # NB: this hack for newer versions of Flask-Script
            # which provide whole bunch of arguments to flask assets
            # instead of useful ones only.
            try:
                if isinstance(args[2], list):
                    args = args[2]
                else:
                    raise IndexError
            except IndexError:
                # restore arguments to same as expected
                # in previous version of Flask-Assets
                args = args[0]

            if not self.env:
                from flask import current_app
                self.env = current_app.jinja_env.assets_environment

            from webassets import script
            return script.main(args, env=self.env)
Ejemplo n.º 2
0
        def run(self, args):
            """Runs the management script.
            If ``self.env`` is not defined, it will import it from
            ``current_app``.
            """

            if not self.env:
                from flask import current_app
                self.env = current_app.jinja_env.assets_environment

            from webassets import script
            return script.main(args, env=self.env)
Ejemplo n.º 3
0
 def handle(self, app, prog, name, remaining_args):
     from webassets import script
     script.main(remaining_args, env=self.env)