Пример #1
0
    def load(self, module):
        """Load a specific module.

        This method:
            Get the Repository class defined in the module
            Write this class in the bundle's repositories
            Return the class

        """
        name = Rule.module_name(module)
        bundle_name = Rule.bundle_name(module)
        bundle = self.server.bundles[bundle_name]
        rep_class = Rule.find_class(module, Repository)

        # Write the class in the bundles
        model_name = self.get_model_name(rep_class)
        bundle.repositories[model_name] = rep_class
        return rep_class