[KSS-checkins] r46880 - in kukit/KSSPylonsWiki/trunk: . ez_setup ksspylonswiki ksspylonswiki/config ksspylonswiki/controllers ksspylonswiki/lib ksspylonswiki/models ksspylonswiki/templates
jvloothuis at codespeak.net
jvloothuis at codespeak.net
Tue Sep 25 22:32:54 CEST 2007
Author: jvloothuis
Date: Tue Sep 25 22:32:54 2007
New Revision: 46880
Removed:
kukit/KSSPylonsWiki/trunk/ez_setup/
Modified:
kukit/KSSPylonsWiki/trunk/development.ini
kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/environment.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/middleware.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/error.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/ksspage.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/page.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/app_globals.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/base.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/helpers.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/models/__init__.py
kukit/KSSPylonsWiki/trunk/ksspylonswiki/templates/autohandler
kukit/KSSPylonsWiki/trunk/ksspylonswiki/websetup.py
kukit/KSSPylonsWiki/trunk/setup.py
Log:
Made the wiki demo work again with current kss.base (without effects for now)
Modified: kukit/KSSPylonsWiki/trunk/development.ini
==============================================================================
--- kukit/KSSPylonsWiki/trunk/development.ini (original)
+++ kukit/KSSPylonsWiki/trunk/development.ini Tue Sep 25 22:32:54 2007
@@ -31,7 +31,7 @@
# pylons.database.session_context.
# %(here) may include a ':' character on Windows environments; this can
# invalidate the URI when specifying a SQLite db via path name
-sqlalchemy.dburi = sqlite:///%(here)s/ksswiki.db
+sqlalchemy.default.url = sqlite:///%(here)s/ksswiki.db
# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
# Debug mode will enable the interactive debugging tool, allowing ANYONE to
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/environment.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/environment.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/environment.py Tue Sep 25 22:32:54 2007
@@ -1,28 +1,38 @@
import os
-import pylons.config
+from sqlalchemy import engine_from_config
+from pylons import config
+
import webhelpers
from ksspylonswiki.config.routing import make_map
+import ksspylonswiki.lib.app_globals as app_globals
+import ksspylonswiki.lib.helpers
def load_environment(global_conf={}, app_conf={}):
- map = make_map(global_conf, app_conf)
- # Setup our paths
- root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- paths = {'root_path': root_path,
- 'controllers': os.path.join(root_path, 'controllers'),
- 'templates': [os.path.join(root_path, path) for path in \
- ('components', 'templates')],
- 'static_files': os.path.join(root_path, 'public')
- }
-
- # The following template options are passed to your template engines
- tmpl_options = {}
+ # Initialize config with the basic options
+
+ root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ paths = dict(root=root,
+ controllers=os.path.join(root, 'controllers'),
+ static_files=os.path.join(root, 'public'),
+ templates=[os.path.join(root, 'templates')])
+
+ # Initialize config with the basic options
+ config.init_app(global_conf, app_conf, package='ksspylonswiki',
+ template_engine='pylonsmyghty', paths=paths)
+
+ config['routes.map'] = make_map()
+ config['pylons.g'] = app_globals.Globals()
+ config['pylons.h'] = ksspylonswiki.lib.helpers
+
+ # Customize templating options via this variable
+ tmpl_options = config['buffet.template_options']
tmpl_options['myghty.log_errors'] = True
tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format)
+
+
+
+ config['pylons.g'].sa_engine = engine_from_config(config,
+ 'sqlalchemy.default.')
- # Add your own template options config options here, note that all config options will override
- # any Pylons config options
-
- # Return our loaded config object
- return pylons.config.Config(tmpl_options, map, paths)
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/middleware.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/middleware.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/config/middleware.py Tue Sep 25 22:32:54 2007
@@ -1,75 +1,67 @@
-from paste import httpexceptions
from paste.cascade import Cascade
from paste.urlparser import StaticURLParser
from paste.registry import RegistryManager
-from paste.deploy.config import ConfigMiddleware, CONFIG
from paste.deploy.converters import asbool
from pylons.error import error_template
from pylons.middleware import ErrorHandler, ErrorDocuments, StaticJavascripts, error_mapper
-import pylons.wsgiapp
+from pylons.wsgiapp import PylonsApp
+from pylons import config
-from ksspylonswiki.config.environment import load_environment
-import ksspylonswiki.lib.helpers
-from ksspylonswiki.lib import app_globals
-from kss.pylons import middleware, initialize_command_set, initialize_javascript
+from ksspylonswiki.config.environment import load_environment
+from kss.pylons import middleware
+from kss.base import load_plugins
+load_plugins('kss-core')
def make_app(global_conf, full_stack=True, **app_conf):
- """Create a WSGI application and return it
-
- global_conf is a dict representing the Paste configuration options, the
- paste.deploy.converters should be used when parsing Paste config options
- to ensure they're treated properly.
-
+ """Create a Pylons WSGI application and return it
+
+ ``global_conf``
+ The inherited configuration for this application. Normally from
+ the [DEFAULT] section of the Paste ini file.
+
+ ``full_stack``
+ Whether or not this application provides a full WSGI stack (by
+ default, meaning it handles its own exceptions and errors).
+ Disable full_stack when this application is "managed" by
+ another WSGI middleware.
+
+ ``app_conf``
+ The application's local configuration. Normally specified in the
+ [app:<name>] section of the Paste ini file (where <name>
+ defaults to main).
"""
- # Setup the Paste CONFIG object, adding app_conf/global_conf for legacy code
- conf = global_conf.copy()
- conf.update(app_conf)
- conf.update(dict(app_conf=app_conf, global_conf=global_conf))
- CONFIG.push_process_config(conf)
-
- # Load our Pylons configuration defaults
- config = load_environment(global_conf, app_conf)
- config.init_app(global_conf, app_conf, package='ksspylonswiki')
-
- # Load our default Pylons WSGI app and make g available
- app = pylons.wsgiapp.PylonsApp(config, helpers=ksspylonswiki.lib.helpers,
- g=app_globals.Globals)
- g = app.globals
- app = ConfigMiddleware(app, conf)
-
- # YOUR MIDDLEWARE
- # Put your own middleware here, so that any problems are caught by the error
- # handling middleware underneath
-
- # If errror handling and exception catching will be handled by middleware
- # for multiple apps, you will want to set full_stack = False in your config
- # file so that it can catch the problems.
+ # Configure the Pylons environment
+ load_environment(global_conf, app_conf)
+
+ # The Pylons WSGI app
+ app = PylonsApp()
+
+ # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
+
if asbool(full_stack):
- # Change HTTPExceptions to HTTP responses
- app = httpexceptions.make_middleware(app, global_conf)
-
- # Error Handling
- app = ErrorHandler(app, global_conf, error_template=error_template, **config.errorware)
-
- # Display error documents for 401, 403, 404 status codes (if debug is disabled also
- # intercepts 500)
+ # Handle Python exceptions
+ app = ErrorHandler(app, global_conf, error_template=error_template,
+ **config['pylons.errorware'])
+
+ # Display error documents for 401, 403, 404 status codes (and
+ # 500 when debug is disabled)
app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
-
+
# Establish the Registry for this application
app = RegistryManager(app)
-
- static_app = StaticURLParser(config.paths['static_files'])
- javascripts_app = StaticJavascripts()
# KSS intialization
- initialize_command_set('core', 'scriptaculous')
- kss_javascripts_app = middleware.StaticKSSJavascripts()
- initialize_javascript(kss_javascripts_app, 'kukit', 'scriptaculous')
+ kss_javascripts_app = middleware.KSSJavascripts()
+ extra_javascripts_app = middleware.ExtraJavascripts()
-
- app = Cascade([static_app, kss_javascripts_app, javascripts_app, app])
+ # Static files
+ javascripts_app = StaticJavascripts()
+ static_app = StaticURLParser(config['pylons.paths']['static_files'])
+ app = Cascade([static_app, kss_javascripts_app,
+ extra_javascripts_app, javascripts_app, app])
return app
+
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/error.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/error.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/error.py Tue Sep 25 22:32:54 2007
@@ -1,33 +1,39 @@
import os.path
-from paste import fileapp
-from pylons.middleware import media_path, error_document_template
-from pylons.util import get_prefix
+
+import paste.fileapp
+from pylons.middleware import error_document_template, media_path
+
from ksspylonswiki.lib.base import *
class ErrorController(BaseController):
- """
- Class to generate error documents as and when they are required. This behaviour of this
- class can be altered by changing the parameters to the ErrorDocuments middleware in
- your config/middleware.py file.
+ """Generates error documents as and when they are required.
+
+ The ErrorDocuments middleware forwards to ErrorController when error
+ related status codes are returned from the application.
+
+ This behaviour can be altered by changing the parameters to the
+ ErrorDocuments middleware in your config/middleware.py file.
"""
def document(self):
- """
- Change this method to change how error documents are displayed
- """
- page = error_document_template % {
- 'prefix': get_prefix(request.environ),
- 'code': request.params.get('code', ''),
- 'message': request.params.get('message', ''),
- }
- return Response(page)
+ """Render the error document"""
+ page = error_document_template % \
+ dict(prefix=request.environ.get('SCRIPT_NAME', ''),
+ code=request.params.get('code', ''),
+ message=request.params.get('message', ''))
+ return page
def img(self, id):
+ """Serve Pylons' stock images"""
return self._serve_file(os.path.join(media_path, 'img', id))
-
+
def style(self, id):
+ """Serve Pylons' stock stylesheets"""
return self._serve_file(os.path.join(media_path, 'style', id))
def _serve_file(self, path):
- fapp = fileapp.FileApp(path)
+ """Call Paste's FileApp (a WSGI application) to serve the file
+ at the specified path
+ """
+ fapp = paste.fileapp.FileApp(path)
return fapp(request.environ, self.start_response)
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/ksspage.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/ksspage.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/ksspage.py Tue Sep 25 22:32:54 2007
@@ -1,91 +1,103 @@
-from ksspylonswiki.lib.base import *
-from kss.commands import KSSCommands
-from kss.commands.selectors import CSS
-from kss.pylons import render_kss_response
+from ksspylonswiki.lib.base import response, BaseController, c, request, render
+from kss.base import KSSCommands
+from kss.base.selectors import CSS
+
+from ksspylonswiki.models import Page, Session, wikiwords
+
class KsspageController(BaseController):
+ def _dispatch_call(self):
+ response.headers['Content-Type'] = 'text/xml'
+ commands = super(KsspageController, self)._dispatch_call()
+ return commands.render()
+
def edit(self):
title = request.params.get('title')
c.title = title
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
if page:
c.content = page.content
form = render('/edit.myt', fragment=True)
commands = KSSCommands()
- core = commands.get('core')
- core.replace_inner_html(CSS('div.content'), form)
+ core = commands.lookup('core')
+ core.replaceInnerHTML(CSS('div.content'), form)
- return render_kss_response(commands)
+ return commands
def save(self):
title = request.params.get('title')
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
if not page:
- page = model.Page()
+ page = Page()
page.title = title
page.content = request.params.get('content','')
c.title = page.title
c.content = page.get_wiki_content()
c.message = 'Successfully saved'
- page.flush()
+ Session.save(page)
+ Session.commit()
html = render('/page.myt', fragment=True)
commands = KSSCommands()
- core = commands.get('core')
- core.replace_inner_html(CSS('div.content'), html)
+ core = commands.lookup('core')
+ core.replaceInnerHTML(CSS('div.content'), html)
core.insert_html_as_first_child(
CSS('div.content'), '<div class="message" style="display: none;">Page saved</div>')
- scriptaculous = commands.get('scriptaculous')
- scriptaculous.effect(CSS('div.message'), 'blinddown')
- scriptaculous.effect(CSS('div.message'), 'blindup', delay=2)
+# scriptaculous = commands.lookup('scriptaculous')
+# scriptaculous.effect(CSS('div.message'), 'blinddown')
+# scriptaculous.effect(CSS('div.message'), 'blindup', delay=2)
- return render_kss_response(commands)
+ return commands
def page(self):
title = request.params.get('title')
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
c.title = title
if page:
c.content = page.get_wiki_content()
commands = KSSCommands()
- core = commands.get('core')
+ core = commands.lookup('core')
content_html = render('/page.myt', fragment=True)
- core.replace_inner_html(CSS('div.content'), content_html)
+ core.replaceInnerHTML(CSS('div.content'), content_html)
footer_html = render('/footer.myt', fragment=True)
- core.replace_html(CSS('p.footer'), footer_html)
+ core.replaceHTML(CSS('p.footer'), footer_html)
- return render_kss_response(commands)
+ return commands
def list(self):
- c.titles = [page.title for page in model.Page.select()]
+ c.titles = [page.title for page in Session.query(Page).all()]
html = render('/titles.myt', fragment=True)
commands = KSSCommands()
- core = commands.get('core')
- core.replace_inner_html(CSS('div.content'), html)
+ core = commands.lookup('core')
+ core.replaceInnerHTML(CSS('div.content'), html)
footer_html = render('/footer.myt', fragment=True)
- core.replace_html(CSS('p.footer'), footer_html)
+ core.replaceHTML(CSS('p.footer'), footer_html)
- return render_kss_response(commands)
+ return commands
def delete(self):
title = request.params.get('title')
- page = model.Page.get_by(title=title)
- page.delete()
- page.flush()
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
+ Session.delete(page)
+ Session.commit()
commands = KSSCommands()
- scriptaculous = commands.get('scriptaculous')
- scriptaculous.effect(CSS('li.kssattr-title-%s' % title), 'fade')
+# scriptaculous = commands.lookup('scriptaculous')
+# scriptaculous.effect(CSS('li.kssattr-title-%s' % title), 'fade')
- return render_kss_response(commands)
+ return commands
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/page.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/page.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/controllers/page.py Tue Sep 25 22:32:54 2007
@@ -1,44 +1,48 @@
-from ksspylonswiki.lib.base import *
-from pylons.database import make_session
+from ksspylonswiki.models import Page, Session, wikiwords
+from ksspylonswiki.lib.base import c, render_response, request, BaseController
+
+from pylons.controllers.util import abort
class PageController(BaseController):
- def __before__(self):
- model.ctx.current = make_session()
def index(self, title):
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
if page:
c.content = page.get_wiki_content()
return render_response('/page.myt')
- elif model.wikiwords.match(title):
+ elif wikiwords.match(title):
return render_response('/new_page.myt')
abort(404)
def edit(self, title):
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
if page:
c.content = page.content
return render_response('/edit.myt')
def save(self, title):
- page = model.Page.get_by(title=title)
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
if not page:
- page = model.Page()
+ page = Page()
page.title = title
page.content = request.params.get('content','')
c.title = page.title
c.content = page.get_wiki_content()
c.message = 'Successfully saved'
- page.flush()
+ Session.save(page)
+ Session.commit()
return render_response('/page.myt')
def list(self):
- c.titles = [page.title for page in model.Page.select()]
+ c.titles = [page.title for page in Session.query(Page).all()]
return render_response('/titles.myt')
def delete(self, title):
- page = model.Page.get_by(title=title)
- page.delete()
- page.flush()
+ page_q = Session.query(Page)
+ page = page_q.filter_by(title=title).first()
+ Session.delete(page)
+ Session.commit()
return self.list()
-
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/app_globals.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/app_globals.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/app_globals.py Tue Sep 25 22:32:54 2007
@@ -1,35 +1,14 @@
-class Globals(object):
+"""The application's Globals object"""
+from pylons import config
- def __init__(self, global_conf, app_conf, **extra):
- """
- Globals acts as a container for objects available throughout
- the life of the application.
+class Globals(object):
+ """Globals acts as a container for objects available throughout the
+ life of the application
+ """
- One instance of Globals is created by Pylons during
- application initialization and is available during requests
- via the 'g' variable.
-
- ``global_conf``
- The same variable used throughout ``config/middleware.py``
- namely, the variables from the ``[DEFAULT]`` section of the
- configuration file.
-
- ``app_conf``
- The same ``kw`` dictionary used throughout
- ``config/middleware.py`` namely, the variables from the
- section in the config file for your application.
-
- ``extra``
- The configuration returned from ``load_config`` in
- ``config/middleware.py`` which may be of use in the setup of
- your global variables.
-
- """
- pass
-
- def __del__(self):
- """
- Put any cleanup code to be run when the application finally exits
- here.
+ def __init__(self):
+ """One instance of Globals is created during application
+ initialization and is available during requests via the 'g'
+ variable
"""
pass
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/base.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/base.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/base.py Tue Sep 25 22:32:54 2007
@@ -1,4 +1,4 @@
-from pylons import Response, c, g, cache, request, session
+from pylons import c, cache, config, g, request, response, session
from pylons.controllers import WSGIController
from pylons.decorators import jsonify, validate
from pylons.templating import render, render_response
@@ -12,7 +12,11 @@
# Insert any code to be run per request here. The Routes match
# is under environ['pylons.routes_dict'] should you want to check
# the action or route vars here
- return WSGIController.__call__(self, environ, start_response)
+ try:
+ return WSGIController.__call__(self, environ, start_response)
+ finally:
+ model.Session.remove()
+
# Include the '_' function in the public names
__all__ = [__name for __name in locals().keys() if not __name.startswith('_') \
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/helpers.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/helpers.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/lib/helpers.py Tue Sep 25 22:32:54 2007
@@ -7,4 +7,4 @@
from pylons.helpers import log
from pylons.i18n import get_lang, set_lang
from kss.pylons.helpers import *
-from kss.scriptaculous.helpers import *
+# from kss.scriptaculous.helpers import *
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/models/__init__.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/models/__init__.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/models/__init__.py Tue Sep 25 22:32:54 2007
@@ -1,19 +1,26 @@
-from sqlalchemy import *
-from sqlalchemy.ext.assignmapper import assign_mapper
-from pylons.database import create_engine
-from pylons.database import session_context as ctx
import re
import sets
-import ksspylonswiki.lib.helpers as h
+
from docutils.core import publish_parts
+from pylons import config
+from sqlalchemy import Column, MetaData, Table, types
+from sqlalchemy.orm import mapper
+from sqlalchemy.orm import scoped_session, sessionmaker
+
+import ksspylonswiki.lib.helpers as h
+
+Session = scoped_session(sessionmaker(autoflush=True, transactional=True,
+ bind=config['pylons.g'].sa_engine))
+
+metadata = MetaData()
+
wikiwords = re.compile(r"\b([A-Z]\w+[A-Z]+\w+)")
-meta = MetaData()
-pages_table = Table('pages', meta,
- Column('title', String(40), primary_key=True),
- Column('content', String(), default=''))
+pages_table = Table('pages', metadata,
+ Column('title', types.String(40), primary_key=True),
+ Column('content', types.String(), default=''))
class Page(object):
def __str__(self):
@@ -29,4 +36,4 @@
content = content.replace(title, link)
return content
-page_mapper = assign_mapper(ctx, Page, pages_table)
+page_mapper = mapper(Page, pages_table)
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/templates/autohandler
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/templates/autohandler (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/templates/autohandler Tue Sep 25 22:32:54 2007
@@ -3,8 +3,7 @@
<title>QuickWiki</title>
<% h.stylesheet_link_tag('/quick.css') %>
<% h.stylesheet_link_tag('/quick.css') %>
- <% h.kss_javascripts() %>
- <% h.scriptaculous_javascripts() %>
+ <% h.kss_javascripts() %>
<link rel="kinetic-stylesheet" type="text/kss" href="/wiki.kss" />
<% h.kss_base_tag() %>
Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/websetup.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/ksspylonswiki/websetup.py (original)
+++ kukit/KSSPylonsWiki/trunk/ksspylonswiki/websetup.py Tue Sep 25 22:32:54 2007
@@ -1,27 +1,30 @@
-import paste.deploy
-from pylons.database import create_engine
-import ksspylonswiki.models as model
+import logging
+
+from paste.deploy import appconfig
+from pylons import config
+
+from ksspylonswiki.config.environment import load_environment
+
+log = logging.getLogger(__name__)
def setup_config(command, filename, section, vars):
- """
- Place any commands to setup ksspylonswiki here.
- """
- conf = paste.deploy.appconfig('config:' + filename)
- conf.update(dict(app_conf=conf.local_conf, global_conf=conf.global_conf))
- paste.deploy.CONFIG.push_process_config(conf)
-
- uri = conf['sqlalchemy.dburi']
- engine = create_engine(uri)
+ """Place any commands to setup quickwiki here"""
+ conf = appconfig('config:' + filename)
+ load_environment(conf.global_conf, conf.local_conf)
- print 'Connecting to database', uri
- model.meta.connect(engine)
+ # Populate the DB on 'paster setup-app'
+ import ksspylonswiki.models as model
- print 'Creating tables'
- model.meta.create_all()
+ log.info("Setting up database connectivity...")
+ engine = config['pylons.g'].sa_engine
+ log.info("Creating tables...")
+ model.metadata.create_all(bind=engine)
+ log.info("Successfully set up.")
- print 'Adding front page data'
+ log.info("Adding front page data...")
page = model.Page()
page.title = 'FrontPage'
- page.content = 'Welcome to the KSSWiki front page.'
- page.flush()
- print 'Successfully setup.'
+ page.content = 'Welcome to the QuickWiki front page.'
+ model.Session.save(page)
+ model.Session.commit()
+ log.info("Successfully set up.")
Modified: kukit/KSSPylonsWiki/trunk/setup.py
==============================================================================
--- kukit/KSSPylonsWiki/trunk/setup.py (original)
+++ kukit/KSSPylonsWiki/trunk/setup.py Tue Sep 25 22:32:54 2007
@@ -1,5 +1,3 @@
-from ez_setup import use_setuptools
-use_setuptools()
from setuptools import setup, find_packages
setup(
@@ -11,7 +9,7 @@
author_email="jeroen.vloothuis at xs4all.nl",
#url="",
install_requires=["Pylons>=0.9.5", "docutils==0.4", "SQLAlchemy>=0.3.6",
- ],#"kss.commands>=dev"],
+ "Myghty"],#"kss.commands>=dev"],
packages=find_packages(),
include_package_data=True,
test_suite = 'nose.collector',
More information about the Kukit-checkins
mailing list