def test_persistent_settings(self): from kotti import get_version from kotti.resources import Settings session = DBSession() [settings] = session.query(Settings).all() self.assertEqual(settings.data, {'kotti.db_version': get_version()}) self.assertEqual(get_settings()['kotti.db_version'], get_version()) settings.data['foo.bar'] = u'baz' self.assertEqual(get_settings()['foo.bar'], u'baz')
def test_persistent_settings(self): from kotti import get_settings from kotti import get_version from kotti import DBSession from kotti.resources import Settings session = DBSession() [settings] = session.query(Settings).all() self.assertEqual(settings.data, {'kotti.db_version': get_version()}) self.assertEqual(get_settings()['kotti.db_version'], get_version()) settings.data['foo.bar'] = u'baz' self.assertEqual(get_settings()['foo.bar'], u'baz')
def test_persistent_settings(self): from kotti import get_settings from kotti import get_version from kotti import DBSession from kotti.resources import Settings session = DBSession() [settings] = session.query(Settings).all() self.assertEqual(settings.data, {"kotti.db_version": get_version()}) self.assertEqual(get_settings()["kotti.db_version"], get_version()) settings.data["foo.bar"] = u"baz" self.assertEqual(get_settings()["foo.bar"], u"baz")
def populate(): if DBSession.query(Node).count() == 0: root = Document(**_ROOT_ATTRS) root.__acl__ = SITE_ACL DBSession.add(root) root['about'] = Document(**_ABOUT_ATTRS) if DBSession.query(Settings).count() == 0: settings = Settings(data={'kotti.db_version': get_version()}) DBSession.add(settings) populate_users()
def populate(): nodecount = DBSession.query(Node).count() if nodecount == 0: p = _add_document_from_file( "home.html", u"", None, u"Welcome to Kotti!", acl=SITE_ACL) _add_document_from_file( "about.html", u"about", p, u"About") settingscount = DBSession.query(Settings).count() if settingscount == 0: settings = Settings(data={'kotti.db_version': get_version()}) DBSession.add(settings) populate_users() DBSession.flush() transaction.commit()
def populate(): session = DBSession() nodecount = session.query(Node).count() if nodecount == 0: root = Document(name=u"", parent=None, title=u"My Site") root.__acl__ = SITE_ACL session.add(root) settingscount = session.query(Settings).count() if settingscount == 0: settings = Settings(data={'kotti.db_version': get_version()}) session.add(settings) principals = get_principals() if u'admin' not in principals: principals[u'admin'] = { 'name': u'admin', 'password': get_settings()['kotti.secret'], 'title': u"Administrator", 'groups': [u'role:admin'], } session.flush() transaction.commit()
def test_it(self): from kotti import get_version assert isinstance(get_version(), str)