Changeset - 5019f7798733
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-06-06 21:32:53
marcin@python-works.com
removed global tmpl call from make_rcextensions script
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/config/rcextensions/make_rcextensions.py
Show inline comments
 
@@ -45,37 +45,37 @@ class MakeRcExt(BasePasterCommand):
 
    min_args = 1
 

	
 
    usage = "CONFIG_FILE"
 
    summary = "Creates additional extensions for rhodecode"
 
    group_name = "RhodeCode"
 
    takes_config_file = -1
 
    parser = Command.standard_parser(verbose=True)
 

	
 
    def command(self):
 
        logging.config.fileConfig(self.path_to_ini_file)
 
        from pylons import config
 

	
 
        def _make_file(ext_file):
 
        def _make_file(ext_file, tmpl):
 
            bdir = os.path.split(ext_file)[0]
 
            if not os.path.isdir(bdir):
 
                os.makedirs(bdir)
 
            with open(ext_file, 'wb') as f:
 
                f.write(tmpl)
 
                log.info('Writen new extensions file to %s' % ext_file)
 

	
 
        here = config['here']
 
        tmpl = pkg_resources.resource_string(
 
            'rhodecode', jn('config', 'rcextensions', '__init__.py')
 
        )
 
        ext_file = jn(here, 'rcextensions', '__init__.py')
 
        if os.path.exists(ext_file):
 
            msg = ('Extension file already exists, do you want '
 
                   'to overwrite it ? [y/n]')
 
            if ask_ok(msg):
 
                _make_file(ext_file)
 
                _make_file(ext_file, tmpl)
 
            else:
 
                log.info('nothing done...')
 
        else:
 
            _make_file(ext_file)
 
            _make_file(ext_file, tmpl)
 

	
 
    def update_parser(self):
 
        pass
0 comments (0 inline, 0 general)