def _add_settings_definition(self):
     """The settings definition does not exist on database so add it."""
     settings_def_repo = SettingsDisplayRepository(self.db)
     settings_definition = SettingsDisplay(skill_id=self.skill.id,
                                           display_data=self.request.json)
     self.settings_definition_id = settings_def_repo.add(
         settings_definition)
 def _check_for_existing_settings_definition(self):
     """Look for an existing database row matching the request."""
     settings_def_repo = SettingsDisplayRepository(self.db)
     settings_defs = settings_def_repo.get_settings_definitions_by_gid(
         self.skill.skill_gid)
     for settings_def in settings_defs:
         if settings_def.display_data == self.request.json:
             self.settings_definition_id = settings_def.id
             break
Exemple #3
0
def add_skill(db, skill_global_id, settings_fields=None):
    display_data = _build_display_data(skill_global_id, settings_fields)
    skill_repo = SkillRepository(db)
    skill_id = skill_repo.ensure_skill_exists(skill_global_id)
    skill = Skill(skill_global_id, skill_id)
    settings_display = SettingsDisplay(skill_id, display_data)
    settings_display_repo = SettingsDisplayRepository(db)
    settings_display.id = settings_display_repo.add(settings_display)

    return skill, settings_display
Exemple #4
0
    def settings_display_repo(self):
        if self._settings_display_repo is None:
            self._settings_display_repo = SettingsDisplayRepository(self.db)

        return self._settings_display_repo