goa/dbmyams.py
branchtls-sprint
changeset 1133 8a409ea0c9ec
parent 1132 96752791c2b6
child 1398 5fe84a5f7035
equal deleted inserted replaced
1132:96752791c2b6 1133:8a409ea0c9ec
   166     """high level method to load all the schema for a lax application"""
   166     """high level method to load all the schema for a lax application"""
   167     # IMPORTANT NOTE: dbmodel schemas must be imported **BEFORE**
   167     # IMPORTANT NOTE: dbmodel schemas must be imported **BEFORE**
   168     # the loader is instantiated because this is where the dbmodels
   168     # the loader is instantiated because this is where the dbmodels
   169     # are registered in the yams schema
   169     # are registered in the yams schema
   170     for compname in config['included-cubes']:
   170     for compname in config['included-cubes']:
   171         comp = __import__('%s.schema' % compname)
   171         __import__('%s.schema' % compname)
   172     loader = GaeSchemaLoader(use_gauthservice=config['use-google-auth'], db=db)
   172     loader = GaeSchemaLoader(use_gauthservice=config['use-google-auth'], db=db)
   173     loader.lib_directory = SCHEMAS_LIB_DIRECTORY
   173     loader.lib_directory = SCHEMAS_LIB_DIRECTORY
   174     if schemaclasses is not None:
   174     if schemaclasses is not None:
   175         for cls in schemaclasses:
   175         for cls in schemaclasses:
   176             loader.load_dbmodel(cls.__name__, goadb.extract_dbmodel(cls))
   176             loader.load_dbmodel(cls.__name__, goadb.extract_dbmodel(cls))
   177     elif config['schema-type'] == 'dbmodel':
   177     elif config['schema-type'] == 'dbmodel':
   178         import schema as appschema
   178         import schema as appschema
   179         for objname, obj in vars(appschema).items():
   179         for obj in vars(appschema).values():
   180             if isinstance(obj, type) and issubclass(obj, goadb.Model) and obj.__module__ == appschema.__name__:
   180             if isinstance(obj, type) and issubclass(obj, goadb.Model) and obj.__module__ == appschema.__name__:
   181                 loader.load_dbmodel(obj.__name__, goadb.extract_dbmodel(obj))
   181                 loader.load_dbmodel(obj.__name__, goadb.extract_dbmodel(obj))
   182     for erschema in ('EGroup', 'EEType', 'ERType', 'RQLExpression',
   182     for erschema in ('EGroup', 'EEType', 'ERType', 'RQLExpression',
   183                      'is_', 'is_instance_of',
   183                      'is_', 'is_instance_of',
   184                      'read_permission', 'add_permission',
   184                      'read_permission', 'add_permission',