def _save_module_to_db(self): # FIXME module is not saved in the right database module = Module(name="mock_module", url="/mock/url", view="mock.view", multiple=False) module.save()
def discover_modules(): patterns = __flatten_patterns_tree__(urls.urlpatterns, excluded=urls.excluded) # Remove all existing modules Module.objects.all().delete() try: for pattern in patterns: module = Module( url=pattern['url'], name=pattern['name'], view=pattern['view'], multiple=False ) module.save() module.update(set__multiple=is_module_managing_occurencies(module)) module.reload() except ValidationError: Module.objects.all().delete() error_msg = 'A validation error occured during the module discovery. Please provide a name to all modules urls ' error_msg += 'using the name argument.' raise ModuleError(error_msg) # something went wrong, delete already added modules except Exception, e: Module.objects.all().delete() raise e
def _save_module_to_db(self): # FIXME module is not saved in the right database module = Module() module.name = 'registered_module' module.url = 'registered_module' module.view = 'registered_module' module.save()
def _save_module_to_db(self): # FIXME module is not saved in the right database module = Module() module.name = "registered_module" module.url = "registered_module" module.view = "registered_module" module.save()
def discover_modules(): patterns = __flatten_patterns_tree__(urls.urlpatterns, excluded=urls.excluded) for pattern in patterns: print pattern # Remove all existing modules Module.objects.all().delete() try: for pattern in patterns: # Module(url=pattern['url'], name=pattern['name']).save() Module(url=pattern['url'], name=pattern['name'], view=pattern['view']).save() except ValidationError: raise ModuleError('A validation error occured during the module discovery. Please provide a name to all modules urls using the name argument.') # something went wrong, delete already added modules Module.objects.all().delete() except Exception, e: raise e # something went wrong, delete already added modules Module.objects.all().delete()