def register_views(self): urls = util.safe_getattr(self._views_module, 'urls') if urls: for url in urls: r = list(url) if isinstance(r[1], str) and '.' not in r[1]: r[1] = self.namespace + '.views.' + r[1] self.add_url(tuple(r), False)
def get_models(app, models_module): models = {} for model_name, model_class in inspect.getmembers(models_module): if inspect.isclass(model_class) and issubclass(model_class, db.Model): if hasattr(model_class, 'RozMeta'): meta = getattr(model_class, 'RozMeta') if safe_getattr(meta, 'ignore' , False): continue models[model_name] = RozModel(app, model_class, model_name) return models