Example #1
0
 def import_model(cls, ins_name):
     try:
         package_space = getattr(cls,  'package_space')
     except AttributeError:
         raise NotImplementedError
     else:
         return import_object(ins_name, package_space)
Example #2
0
 def import_model(cls, ins_name):
     try:
         package_space = getattr(cls,  'package_space')
     except AttributeError:
         raise NotImplementedError
     else:
         return import_object(ins_name, package_space)
Example #3
0
 def import_model(cls, ins_name):
     """Import model class in models package
     """
     try:
         package_space = getattr(cls, 'package_space')
     except AttributeError:
         raise ValueError('package_space not exist')
     else:
         return import_object(ins_name, package_space)
Example #4
0
 def import_model(cls, ins_name):
     """Import model class in models package
     """
     try:
         package_space = getattr(cls, 'package_space')
     except AttributeError:
         raise ValueError('package_space not exist')
     else:
         return import_object(ins_name, package_space)
Example #5
0
def install_helper(installing_helper_list, package_space):
    for item in installing_helper_list:
        # db model package
        package = import_object('.'.join(['helpers', item]), package_space)
        package_space[item] = _HelperObjectDict()
        # all py files  included by package
        all_modules = getattr(package, '__all__', [])
        for m in all_modules:
            try:
                module =  import_object('.'.join(['helpers',item, m]), package_space)
            except Exception as e:
                helper_log.error('module helpers.%s.%s Import Error'%(item, m), exc_info=True)
                sys.exit(0)

            for model_name in getattr(module, 'MODEL_SLOTS', []):
                model = getattr(module, model_name, None)
                if model:
                    camel_name = model.__name__
                    underscore_name = camel_to_underscore(camel_name)

                    package_space[item][underscore_name] = model()
                    package_space[item][camel_name] = model
Example #6
0
def _install_app(package_space):
    for app in getattr(import_object('apps.settings', package_space), 'INSTALLED_APPS'):
       _ = import_object('.'.join(['apps', app]), package_space)        
Example #7
0
def _install_app(package_space):
    for app in getattr(import_object('apps.settings', package_space),
                       'INSTALLED_APPS'):
        import_object('.'.join(['apps', app]), package_space)