Example #1
0
    def execute(self, args, options, global_options):
        from uliweb.utils.common import check_apps_dir

        #add apps_dir to global_options and insert it to sys.path
        global_options.apps_dir = apps_dir = os.path.normpath(os.path.join(global_options.project, 'apps'))
        if apps_dir not in sys.path:
            sys.path.insert(0, apps_dir)
        
        if self.check_apps_dirs:
            check_apps_dir(global_options.apps_dir)
        if self.check_apps and args: #then args should be apps
            all_apps = self.get_apps(global_options)
            apps = args
            args = []
            for p in apps:
                if p not in all_apps:
                    print 'Error: Appname %s is not a valid app' % p
                    sys.exit(1)
                else:
                    args.append(p)
        try:
            self.handle(options, global_options, *args)
        except CommandError, e:
            log.exception(e)
            sys.exit(1)
Example #2
0
 def handle(self, options, global_options, *args):
     from uliweb.utils.common import check_apps_dir
     opts = {'verbose':global_options.verbose, 'template':options.template,
         'exact':options.exact}
     if options.project:
         check_apps_dir(global_options.apps_dir)
         app = self.get_application(global_options)
         
         _process(global_options.apps_dir, options.locale, opts, output_dir=global_options.project)
     elif options.apps or args:
         check_apps_dir(global_options.apps_dir)
         
         app = self.get_application(global_options)
         if options.apps:
             _apps = SimpleFrame.get_apps(global_options.apps_dir)
         else:
             _apps = args
         apps_dir = os.path.normpath(os.path.abspath(global_options.apps_dir))
         for appname in _apps:
             path = SimpleFrame.get_app_dir(appname)
             if global_options.verbose:
                 print('Processing... app=>[%s] path=>[%s]' % (appname, path))
             _process(path, options.locale, opts)
     elif options.uliweb:
         path = pkg.resource_filename('uliweb', '')
         _process(path, options.locale, opts)
     elif options.directory:
         _process(options.directory, options.locale, opts)
Example #3
0
 def handle(self, options, global_options, *args):
     from uliweb.utils.common import check_apps_dir
     opts = {'verbose':global_options.verbose, 'template':options.template,
         'exact':options.exact}
     if options.project:
         check_apps_dir(global_options.apps_dir)
         app = self.get_application(global_options)
         
         _process(global_options.apps_dir, options.locale, opts, output_dir=global_options.project)
     elif options.apps or args:
         check_apps_dir(global_options.apps_dir)
         
         app = self.get_application(global_options)
         if options.apps:
             _apps = SimpleFrame.get_apps(global_options.apps_dir)
         else:
             _apps = args
         apps_dir = os.path.normpath(os.path.abspath(global_options.apps_dir))
         for appname in _apps:
             path = SimpleFrame.get_app_dir(appname)
             if global_options.verbose:
                 print 'Processing... app=>[%s] path=>[%s]' % (appname, path)
             _process(path, options.locale, opts)
     elif options.uliweb:
         path = pkg.resource_filename('uliweb', '')
         _process(path, options.locale, opts)
     elif options.directory:
         _process(options.directory, options.locale, opts)
Example #4
0
    def execute(self, args, options, global_options):
        from uliweb.utils.common import check_apps_dir

        #add apps_dir to global_options and insert it to sys.path
        if global_options.apps_dir not in sys.path:
            sys.path.insert(0, global_options.apps_dir)

        if self.check_apps_dirs:
            check_apps_dir(global_options.apps_dir)
        if self.check_apps and args:  #then args should be apps
            all_apps = self.get_apps(global_options)
            apps = args
            args = []
            for p in apps:
                if p not in all_apps:
                    print 'Error: Appname %s is not a valid app' % p
                    sys.exit(1)
                else:
                    args.append(p)
        try:
            self.handle(options, global_options, *args)
        except CommandError, e:
            log.exception(e)
            sys.exit(1)