goa/goavreg.py
changeset 2476 1294a6bdf3bf
parent 1977 606923dff11b
child 2650 18aec79ec3a3
equal deleted inserted replaced
2475:b6753521129d 2476:1294a6bdf3bf
    35                             'cubicweb.web.views')
    35                             'cubicweb.web.views')
    36         self.load_directory(join(CW_SOFTWARE_ROOT, 'goa', 'appobjects'),
    36         self.load_directory(join(CW_SOFTWARE_ROOT, 'goa', 'appobjects'),
    37                             'cubicweb.goa.appobjects')
    37                             'cubicweb.goa.appobjects')
    38         for cube in reversed(self.config.cubes()):
    38         for cube in reversed(self.config.cubes()):
    39             self.load_cube(cube)
    39             self.load_cube(cube)
    40         self.load_application(applroot)
    40         self.load_instance(applroot)
    41 
    41 
    42     def load_directory(self, directory, cube, skip=()):
    42     def load_directory(self, directory, cube, skip=()):
    43         for filename in listdir(directory):
    43         for filename in listdir(directory):
    44             if filename[-3:] == '.py' and not filename in skip:
    44             if filename[-3:] == '.py' and not filename in skip:
    45                 self._import('%s.%s' % (cube, filename[:-3]))
    45                 self._import('%s.%s' % (cube, filename[:-3]))
    47     def load_cube(self, cube):
    47     def load_cube(self, cube):
    48         self._auto_load(self.config.cube_dir(cube),
    48         self._auto_load(self.config.cube_dir(cube),
    49                         cube in self.config['included-cubes'],
    49                         cube in self.config['included-cubes'],
    50                         cube)
    50                         cube)
    51 
    51 
    52     def load_application(self, applroot):
    52     def load_instance(self, applroot):
    53         self._auto_load(applroot, self.config['schema-type'] == 'dbmodel')
    53         self._auto_load(applroot, self.config['schema-type'] == 'dbmodel')
    54 
    54 
    55     def _import(self, modname):
    55     def _import(self, modname):
    56         obj = __import__(modname)
    56         obj = __import__(modname)
    57         for attr in modname.split('.')[1:]:
    57         for attr in modname.split('.')[1:]: