cwconfig.py
changeset 9251 e4d753c8b1c4
parent 8850 4032499c701e
child 9255 46f41c3e1443
equal deleted inserted replaced
9250:0dcc68dd8458 9251:e4d753c8b1c4
   204 
   204 
   205 def possible_configurations(directory):
   205 def possible_configurations(directory):
   206     """return a list of installed configurations in a directory
   206     """return a list of installed configurations in a directory
   207     according to \*-ctl files
   207     according to \*-ctl files
   208     """
   208     """
   209     return [name for name in ('repository', 'twisted', 'all-in-one')
   209     return [name for name in ('repository', 'all-in-one')
   210             if exists(join(directory, '%s.conf' % name))]
   210             if exists(join(directory, '%s.conf' % name))]
   211 
   211 
   212 def guess_configuration(directory):
   212 def guess_configuration(directory):
   213     """try to guess the configuration to use for a directory. If multiple
   213     """try to guess the configuration to use for a directory. If multiple
   214     configurations are found, ConfigurationError is raised
   214     configurations are found, ConfigurationError is raised
   938         if not exists(home):
   938         if not exists(home):
   939             raise ConfigurationError('no such instance %s (check it exists with'
   939             raise ConfigurationError('no such instance %s (check it exists with'
   940                                      ' "cubicweb-ctl list")' % appid)
   940                                      ' "cubicweb-ctl list")' % appid)
   941         return home
   941         return home
   942 
   942 
   943     MODES = ('common', 'repository', 'Any', 'web')
   943     MODES = ('common', 'repository', 'Any')
   944     MCOMPAT = {'all-in-one': MODES,
   944     MCOMPAT = {'all-in-one': MODES,
   945                'repository': ('common', 'repository', 'Any'),
   945                'repository': ('common', 'repository', 'Any')}
   946                'twisted'   : ('common', 'web'),}
       
   947     @classmethod
   946     @classmethod
   948     def accept_mode(cls, mode):
   947     def accept_mode(cls, mode):
   949         #assert mode in cls.MODES, mode
   948         #assert mode in cls.MODES, mode
   950         return mode in cls.MCOMPAT[cls.name]
   949         return mode in cls.MCOMPAT[cls.name]
   951 
   950