def settingsCommand(init=True): if init: # pragma: no cover config.initialize(Configurator(), autoinclude=True) args = SettingsCommand.parser.parse_args() cmd = SettingsCommand(args) cmd.run()
def _init_ptah(self, handler=None, *args, **kw): config.initialize(self.p_config, ("ptah", self.__class__.__module__), initsettings=False) config.initialize_settings(self._settings, self.p_config) # create sql tables Base = sqlahelper.get_base() Base.metadata.drop_all() Base.metadata.create_all() transaction.commit()
def _init_ptah(self, settings=None, handler=None, *args, **kw): if settings is None: settings = self._settings config.initialize(('ptah', self.__class__.__module__)) config.initialize_settings(settings, self.p_config) # create sql tables Base = sqlahelper.get_base() Base.metadata.drop_all() Base.metadata.create_all() transaction.commit()
def main(init=True): if init: # pragma: no cover pconfig = Configurator() pconfig.begin() pconfig.include('ptah') config.initialize(pconfig, autoinclude=True) pconfig.commit() ptah.initialize_settings(pconfig, None) args = SettingsCommand.parser.parse_args() cmd = SettingsCommand(args) cmd.run()
def run(self): # load all ptah packages config.initialize() # print defaults if self.options.printcfg: data = config.Settings.export(True) parser = ConfigParser.ConfigParser(dict_type=OrderedDict) items = data.items() items.sort() for key, val in items: parser.set(ConfigParser.DEFAULTSECT, key, val) fp = StringIO.StringIO() try: parser.write(fp) finally: pass print fp.getvalue() return if self.options.all: section = '' else: section = self.options.section # print description groups = config.Settings.items() groups.sort() for name, group in groups: if section and name != section: continue print '' title = group.title or name print grpTitleWrap.fill(title) if group.description: print grpDescriptionWrap.fill(group.description) print for node in group.schema: default = '<required>' if node.required else node.default print nameWrap.fill( '%s.%s: %s (%s: %s)'%( name, node.name, node.title, node.typ.__class__.__name__, default)) print nameTitleWrap.fill(node.description) print
def command(self): # load all ptah packages pconfig = testing.setUp() config.initialize(pconfig, self._include, autoinclude=True) registry = config.get_cfg_storage(resources.STATIC_ID) if self.options.dump: basepath = self.options.dump.strip() if not os.path.exists(basepath): os.makedirs(basepath) if not os.path.isdir(basepath): print "Output path is not directory." return items = registry.items() items.sort() for name, (path, pkg) in items: print "* Coping from '%s' %s"%(pkg, path) d = resources.buildTree(path) di = d.items() di.sort() for p, _t in di: bp = os.path.join(basepath, name, p) dest_dir = os.path.split(bp)[0] if not os.path.exists(dest_dir): os.makedirs(dest_dir) forp = '%s/%s'%(pkg, p.split(pkg, 1)[-1]) if os.path.exists(bp): print ' skipping ../%s'%forp else: print ' coping ../%s'%forp shutil.copyfile(os.path.join(path, p), bp) print print basepath return # list static sections if self.options.section: items = registry.items() items.sort() for name, (path, pkg) in items: print grpTitleWrap.fill(name) print nameWrap.fill('by: %s'%pkg) p = path.split(pkg, 1)[-1] print nameTitleWrap.fill(' ../%s%s'%(pkg, p)) print
def _init_ptah(self, settings=None, handler=None, *args, **kw): st = dict(self._settings) if settings is not None: st.update(settings) config.initialize(('ptah', self.__class__.__module__), registry = self.p_config.registry) config.initialize_settings(st, self.p_config) # create sql tables Base = sqlahelper.get_base() Base.metadata.drop_all() Base.metadata.create_all() transaction.commit()
def _setup_ptah(self): config.initialize(self.p_config, ('ptah', self.__class__.__module__))
def _init_ptah(self, settings={}, handler=None, *args, **kw): config.initialize(self.p_config, ('ptah', self.__class__.__module__), initsettings = False) config.initialize_settings(settings, self.p_config) config.start(self.p_config)
def command(self): # load all ptah packages config.initialize() if self.options.filename: self.print_template(self.options.filename) return if self.options.custfile: self.customize_template(self.options.custfile, self.options.customdir, self.options.force) return # print description if self.options.all: section = '' else: section = self.options.section items = tmpl.registry.items() items.sort() for name, data in items: if section and name != section: continue dist = None pkg_name = name while 1: try: dist = pkg_resources.get_distribution(pkg_name) if dist is not None: break except pkg_resources.DistributionNotFound: if '.' not in pkg_name: break pkg_name = pkg_name.rsplit('.',1)[0] if dist is None: continue print '' title = name print grpTitleWrap.fill(title) #if group.description: # print grpDescriptionWrap.fill(group.description) dist_loc_len = len(dist.location) print templates = data.items() templates.sort() for filename, (path,title,desc,_tmpl,pkg_name) in templates: if path.lower().startswith(dist.location.lower()): path = '..%s'%path[dist_loc_len:] print nameWrap.fill('%s: %s'%(filename, path)) if title: print nameTitleWrap.fill(title) if desc: print nameTitleWrap.fill(desc) data = _Manager.layers.get(name) if data: for pkgname, abspath, path in data: # pragma: no cover if os.path.exists(os.path.join(abspath, filename)): print overWrap.fill( 'overriden by: %s (%s)'%(pkgname, path)) print
def _init_ptah(self, settings={}, newReg=None, *args, **kw): config.initialize(('ptah.config', self.__class__.__module__), reg=newReg)
def _setup_ptah(self): config.initialize( self.p_config, ('ptah.view', self.__class__.__module__), initsettings=False)
def _init_ptah(self, settings={}, *args, **kw): config.initialize(("ptah.config", self.__class__.__module__))
def _init_ptah(self, settings={}, handler=None, *args, **kw): config.initialize(('ptah', self.__class__.__module__), reg = Components('test')) config.initialize_settings(settings, self.p_config) config.start(self.p_config)
def _init_ptah(self, settings={}, *args, **kw): config.initialize( ('ptah.config', self.__class__.__module__), reg = Components('test'))
def _setup_ptah(self): config.initialize(('ptah.view', self.__class__.__module__))