def update_defaults(session, tid, appdata): ConfigFactory(session, tid).update_defaults() langs = EnabledLanguage.list(session, tid) session.query(ConfigL10N).filter(ConfigL10N.tid == tid, not_(ConfigL10N.var_name.in_(list(set(ConfigL10NFilters['node']).union(ConfigL10NFilters['notification']))))).delete(synchronize_session='fetch') ConfigL10NFactory(session, tid).update_defaults('node', langs, appdata['node']) ConfigL10NFactory(session, tid).update_defaults('notification', langs, appdata['templates'])
def update_defaults(session, tid, appdata): langs = EnabledLanguage.list(session, tid) session.query(ConfigL10N).filter( ConfigL10N.tid == tid, not_( ConfigL10N.var_name.in_(NodeL10NFactory.keys + NotificationL10NFactory.keys))).delete( synchronize_session='fetch') NodeL10NFactory(session, tid).update_defaults(langs, appdata['node']) NotificationL10NFactory(session, tid).update_defaults(langs, appdata['templates'])
def update_defaults(session, tid, appdata): fix_tenant_config(session, tid) # Set the system version to the current aligned cfg ConfigFactory(session, tid, 'node').set_val(u'version', __version__) langs = EnabledLanguage.list(session, tid) session.query(ConfigL10N).filter(ConfigL10N.tid == tid, not_(ConfigL10N.var_name.in_(NodeL10NFactory.keys + NotificationL10NFactory.keys))).delete(synchronize_session='fetch') NodeL10NFactory(session, tid).update_defaults(langs, appdata['node']) NotificationL10NFactory(session, tid).update_defaults(langs, appdata['templates'])
def reset_templates(self, l10n_data_src): langs = EnabledLanguage.list(self.session, self.tid) self.update_defaults(langs, l10n_data_src, reset=True)
def reset(self, group, data): langs = EnabledLanguage.list(self.session, self.tid) self.update_defaults(group, langs, data, reset=True)