so just for completeness, in addition to the changes to environment.py
which are explained in http://pylonshq.com/docs/en/1.0/upgrading/
the attached diff shows what i had to change to get my app ported (and
the tests passing).
thanx for the good work on pylons 1.0!
On Sat, Feb 6, 2010 at 4:46 AM, Ben Bangert <[email protected]> wrote:
>
> You'll need to login to file a bug report, or feel free to reply to this
> announcement with the issue.
>
>
> Thanks (in alphabetical order) to Mike Bayer, Ian Bicking, Mike Burrows,
> Graham Higgins, Phil Jenvey, Mike Orr, and anyone else I missed for all their
> hard work on making Pylons and its various components what they are today.
>
> - Ben
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.
Index: wals2/tests/__init__.py
===================================================================
--- wals2/tests/__init__.py (revision 56)
+++ wals2/tests/__init__.py (working copy)
@@ -7,11 +7,12 @@
This module initializes the application via ``websetup`` (`paster
setup-app`) and provides the base testing objects.
"""
from epubtk_utils.webhelpers import TestController as BaseTestController
from paste.deploy import loadapp
-from pylons import config, url
+from pylons import url
from routes.util import URLGenerator
from webtest import TestApp
@@ -20,9 +21,10 @@
NUMBER_OF_FEATURES = 160
-# Invoke websetup with the current config file
-#SetupCommand('setup-app').run([config['__file__']])
+SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']])
+
+
environ = {}
class TestController(BaseTestController):
@@ -30,10 +32,12 @@
def setUp(self):
"""Method called by nose before running each test"""
# Loading the application:
- wsgiapp = loadapp('config:%s' % config['__file__'])
+ wsgiapp = pylons.test.pylonsapp
+ config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
def tearDown(self):
"""Method called by nose after running each test"""
pass
+
Index: wals2/config/middleware.py
===================================================================
--- wals2/config/middleware.py (revision 62)
+++ wals2/config/middleware.py (working copy)
@@ -35,12 +35,10 @@
"""
# Configure the Pylons environment
- load_environment(global_conf, app_conf)
+ config = load_environment(global_conf, app_conf)
# The Pylons WSGI app
- app = PylonsApp()
+ app = PylonsApp(config=config)
# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
@@ -68,4 +66,5 @@
static_app = StaticURLParser(config['pylons.paths']['static_files'])
app = Cascade([static_app, app])
+ app.config = config
return app
Index: wals2/config/routing.py
===================================================================
--- wals2/config/routing.py (revision 62)
+++ wals2/config/routing.py (working copy)
@@ -6,7 +6,6 @@
"""
import re
-from pylons import config
from routes import Mapper
#
@@ -28,7 +27,7 @@
FILENAME_PATTERN = WORD_PATTERN+"\."+EXTENSION_PATTERN
-def make_map():
+def make_map(config):
"""Create, configure and return the routes Mapper"""
map = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug'])
Index: wals2/websetup.py
===================================================================
--- wals2/websetup.py (revision 52)
+++ wals2/websetup.py (working copy)
@@ -1,6 +1,8 @@
"""Setup the wals2 application"""
import logging
+import pylons.test
+
from wals2.config.environment import load_environment
from wals2.model import meta
@@ -8,7 +10,8 @@
def setup_app(command, conf, vars):
"""Place any commands to setup wals2 here"""
- load_environment(conf.global_conf, conf.local_conf)
+ if not pylons.test.pylonsapp:
+ load_environment(conf.global_conf, conf.local_conf)
# Create the tables if they don't already exist
#meta.metadata.create_all(bind=meta.engine)
Index: wals2/lib/app_globals.py
===================================================================
--- wals2/lib/app_globals.py (revision 60)
+++ wals2/lib/app_globals.py (working copy)
@@ -17,7 +17,7 @@
"""
- def __init__(self):
+ def __init__(self, config):
"""One instance of Globals is created during application
initialization and is available during requests via the
'app_globals' variable