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)
def handle(self, options, global_options, *args): opts = { 'verbose': global_options.verbose, 'template': options.template, 'exact': options.exact } if options.project: _process(global_options.project, options.locale, opts) elif options.apps or args: 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 not path.startswith(apps_dir): continue _process(SimpleFrame.get_app_dir(appname), 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)
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)
def develop_build(): from uliweb.utils.common import pkg import uliweb.core.SimpleFrame as sf app_apps = sf.get_apps(application.apps_dir) contrib_path = pkg.resource_filename('uliweb.contrib', '') apps_dirs = [(application.apps_dir, ''), (contrib_path, 'uliweb.contrib')] #using entry point to find installed apps try: from pkg_resources import iter_entry_points except: iter_entry_points = None if iter_entry_points: #process apps group for p in iter_entry_points('uliweb_apps'): apps_dirs.append((os.path.join(p.dist.location, p.module_name), p.module_name)) catalogs, apps = get_apps(application, apps_dirs, app_apps) if iter_entry_points: #proces single app for p in iter_entry_points('uliweb_app'): _get_app(os.path.join(p.dist.location, p.module_name), p.module_name, apps, catalogs, app_apps) from forms import GenericForm f = GenericForm(method="post") if request.method == 'GET': # ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) ini_to_form(f, application.settings) else: r = f.validate(request.params) if r: ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) flag = form_to_ini(f, ini, application.settings) if flag: ini.save() return {'catalogs': catalogs, 'generic_form': f}
def develop_build(): from uliweb.utils.common import pkg import uliweb.core.SimpleFrame as sf app_apps = sf.get_apps(application.apps_dir) contrib_path = pkg.resource_filename('uliweb.contrib', '') apps_dirs = [(application.apps_dir, ''), (contrib_path, 'uliweb.contrib')] #using entry point to find installed apps try: from pkg_resources import iter_entry_points except: iter_entry_points = None if iter_entry_points: #process apps group for p in iter_entry_points('uliweb_apps'): apps_dirs.append((os.path.join(p.dist.location, p.module_name), p.module_name)) catalogs, apps = get_apps(application, apps_dirs, app_apps) if iter_entry_points: #proces single app for p in iter_entry_points('uliweb_app'): _get_app(os.path.join(p.dist.location, p.module_name), p.module_name, apps, catalogs, app_apps) from forms import GenericForm f = GenericForm(method="post") if request.method == 'GET': # ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) ini_to_form(f, application.settings) else: r = f.validate(request.params) if r: ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) flag = form_to_ini(f, ini, application.settings) if flag: ini.save() return {'catalogs':catalogs, 'generic_form':f}
def handle(self, options, global_options, *args): opts = {'verbose':global_options.verbose} if options.project: _process(global_options.project, options.locale, opts) elif options.apps or args: 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 not path.startswith(apps_dir): continue _process(SimpleFrame.get_app_dir(appname), 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)
def handle(self, options, global_options, *args): opts = {'verbose':global_options.verbose, 'template':options.template, 'exact':options.exact} if options.project: _process(global_options.project, options.locale, opts) elif options.apps or args: 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)
def develop_edit_app(): ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) flag = False module = str(request.GET['module']) import uliweb.core.SimpleFrame as sf app_apps = sf.get_apps(application.apps_dir) if request.GET['action'] == 'add': if not ini.GLOBAL.get('INSTALLED_APPS'): ini.GLOBAL.INSTALLED_APPS = app_apps if module not in ini.GLOBAL.INSTALLED_APPS: ini.GLOBAL.INSTALLED_APPS.append(module) flag = True else: if not ini.GLOBAL.get('INSTALLED_APPS'): ini.GLOBAL.INSTALLED_APPS = app_apps if module in ini.GLOBAL.INSTALLED_APPS: ini.GLOBAL.INSTALLED_APPS.remove(module) flag = True if flag: ini.save() return 'ok'
def develop_edit_app(): ini = Ini(os.path.join(application.apps_dir, 'settings.ini')) flag = False module = str(request.GET['module']) import uliweb.core.SimpleFrame as sf app_apps = sf.get_apps(application.apps_dir) if request.GET['action'] == 'add': if not ini.GLOBAL.get('INSTALLED_APPS'): ini.GLOBAL.INSTALLED_APPS = app_apps if module not in ini.GLOBAL.INSTALLED_APPS: ini.GLOBAL.INSTALLED_APPS.append(module) flag = True else: if not ini.GLOBAL.get('INSTALLED_APPS'): ini.GLOBAL.INSTALLED_APPS = app_apps if module in ini.GLOBAL.INSTALLED_APPS: ini.GLOBAL.INSTALLED_APPS.remove(module) flag = True if flag: ini.save() return 'ok'