--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.
Well, what the page is saying is that, for some reason, your 'self.app.get' is not generating a request object. I don't have a reason why, though. At the least, I need to ask the following of you:
1. Which version of TurboGears are you running these tests with?
2. Which version of TurboGears did you start with (need to check to see if maybe we missed something during the upgrade process)
3. If possible, is there a place where we can read the code and try it out for ourselves?
Have you tested it with a clean virtualenv installed from scratch with 2.1.2?
If you upgraded it might be that you ended up having an unexpected
combination of libraries installed.
I tried doing that with TG 2.1.2 and TG 2.1.3, as follows:
# TG 2.1.2 attempt:
virtualenv --no-site-packages tg212
cd tg212/
source bin/activate
easy_install turbogears2==2.1.2 tg.devtools==2.1.2
# copied in unmodified projects (2.1.2 app) folder from
http://alwaysreformed.com/publicdocs/tg212.7z
cd projects/
python setup.py develop
python projects/tests/nosy.py
# pkg_resources.VersionConflict: (ToscaWidgets 0.8.7.1dev-20111004
(/home/tim/Documents/MyWebPages/arwd/projects/tg212/lib/python2.6/site-packages/ToscaWidgets-0.8.7.1dev_20111004-py2.6.egg),
Requirement.parse('ToscaWidgets>0.9.7'))
easy_install -U toscawidgets
python projects/tests/nosy.py
# pkg_resources.DistributionNotFound: tgext.crud>=0.3.7
# Added tgext.crud>=0.3.7 to requirements
python setup.py develop
python projects/tests/nosy.py
# ImportError: No module named genshi.filters
# Added Genshi to requirements
python setup.py develop
python projects/tests/nosy.py
# ImportError: No module named pylonshq
# Added repoze.what_pylons to requirements
python setup.py develop
python projects/tests/nosy.py
# TypeError: No object (name: request) has been registered for this thread
# TG 2.1.3 attempt:
virtualenv --no-site-packages tg213
cd tg213/
source bin/activate
easy_install tg.devtools
# copied in projects (app) folder from
http://alwaysreformed.com/publicdocs/tg21env-dev-2.1.3.7z, with TG 2.1.3
quickstart template diffs merged in
cd projects
python setup.py develop
python projects/tests/nosy.py
TypeError: No object (name: request) has been registered for this thread
I tried all the following but still got the same error after trying each
one:
� I commented out all code in the projects/tests folder except that in
nosy.py.
� I temporarily deleted all files & folders in the projects/tests
directory except nosy.py. So, I think the error is not generated by the
tests' call to self.app.get.
� I ran `nosetests` without using nosy.py.
If I comment out line 28 of projects/controllers/project/bill.py, which
appears in the traceback, the same error appears, but instead of listing
line 28, the traceback lists:
File
"/home/tim/Documents/MyWebPages/arwd/projects/tg21env-dev/projects/projects/controllers/project/bill.py",
line 32, in BillController
@require(is_client or is_manager)
If I comment out all the lines like @require(is_client or is_manager) in
that file, then the traceback reports the same error, generated from
these different lines, which still indicate the problem is that
"request" is missing:
File
"/home/tim/Documents/MyWebPages/arwd/projects/tg21env-dev/projects/projects/widgets/tasks_manage.py",
line 19, in TaskTreeGridManage
JSLink(link=url('/javascript/jquery.jqGrid-%s/js/i18n/grid.locale-en.js'
% version)),
File
"/home/tim/Documents/MyWebPages/arwd/projects/tg21env-dev/lib/python2.6/site-packages/tg/controllers/util.py",
line 91, in url
base_url = pylons.request.environ['SCRIPT_NAME'] + base_url
So my main question is, how can I properly instantiate the "request"
variable when (or in terms of execution order, before) running my tests?
In case this is a dependency problem, I did a visual comparison of my TG
2.1.2 virtualenv's site-packages directory with the list here
http://www.turbogears.org/2.1/downloads/2.1.2/ and found my virtualenv
is missing these packages:
AddOns-0.7.zip
BytecodeAssembler-0.6.zip
Chameleon-1.3.0-rc1.tar.gz
DecoratorTools-1.8.zip
Extremes-1.1.1.zip
Jinja2-2.6.tar.gz
Kajiki-0.3.4.tar.gz
Mako-0.5.0.tar.gz
PEAK-Rules-0.5a1.dev-r2686.tar.gz
PasteDeploy-1.3.4.tar.gz
PasteScript-1.7.4.2.tar.gz
Pygments-1.4.tar.gz
SymbolType-1.0.zip
TurboJson-1.3.1.tar.gz
TurboJson-1.3.2.tar.gz
TurboKid-1.0.5.tar.gz
chameleon.core-1.0.3.tar.gz
chameleon.genshi-1.0b4.tar.gz
coverage-3.5.1.tar.gz
coverage-3.5.tar.gz
decorator-3.3.2.tar.gz
elementtree-1.2.7-20070827-preview.zip
hashlib-20081119.zip
kid-0.9.6.tar.gz
ordereddict-1.1.tar.gz
pysqlite-2.6.3.tar.gz
pytz-2011g.zip
simplegeneric-0.7.zip
simplegeneric-0.8.zip
simplejson-2.2.1.tar.gz
sourcecodegen-0.6.14.tar.gz
sprox-0.7b1.tar.gz
tgext.admin-0.3.11.tar.gz
tgext.crud-0.3.12.tar.gz
tw.dojo-0.9.9.tar.gz
uuid-1.30.tar.gz
wsgiref-0.1.2.zip
zope.component-3.10.0.tar.gz
zope.event-3.5.0-1.tar.gz
zope.i18n-3.7.4.tar.gz
zope.i18nmessageid-3.5.3.tar.gz
zope.interface-3.6.3.tar.gz
zope.schema-3.8.0.tar.gz
My virtualenv has these packages that are not in the download list above:
concurrent
devtools
distribute-0.6.10-py2.6.egg
distribute-0.6.10-py2.6.egg-info
docutils-0.7-py2.6.egg
futures
marrow
marrow.mailer-4.0.0b3-py2.6.egg-info
marrow.util-1.2.0-py2.6.egg-info
migrate
PasteScript-1.7.3-py2.6.egg-info
pip-0.7.2-py2.6.egg-info
pygments
Pygments-1.4-py2.6.egg-info
repoze.tm2-1.0a5-py2.6.egg
repoze.what_quickstart-1.0.6-py2.6.egg
repoze.who_friendlyform-1.0.4-py2.6.egg
setuptools
simplejson-2.1.6-py2.6.egg-info
sqlalchemy_migrate-0.7.1-py2.6.egg-info
tgext.menu-1.0b3-py2.6.egg
tgext.menu-1.0rc1-py2.6.egg
turbomail
TurboMail-3.0.3-py2.6.egg-info
tw.jquery-0.9.9-py2.6.egg
tw.jquery-0.9.10-py2.6.egg-info
tw.uitheme-0.1a0-py2.6.egg
tw.uitheme-0.2.2-py2.6.egg-info
tw2.core-2.0b4-py2.6.egg
tw2.devtools-2.0b5-py2.6.egg
tw2.dynforms-2.0a2-py2.6.egg
tw2.forms-2.0b4-py2.6.egg
tw2.sqla-2.0a1-py2.6.egg
zope.interface-3.6.5-py2.6.egg-info
zope.sqlalchemy-0.4-py2.6.egg
I need some direction--which packages should I try upgrading, if any?
Should I try installing/upgrading to all of the ones in the official
package index list?
I've used pip in this virtualenv; could that be a problem?
Thanks again for your help!
Tim
Inside widgets you should use lurl instead of url.
lurl calls are processed at render time instead of call time so they
avoid access to request outside a request.
Just noticed one peculiarity concerning this matter which is the "link"
parameter of resource widgets like CSSLink: When setting this parameter,
you should use neither url() nor lurl(), because ToscaWidgets already
does this for you and breaks lurl(). For all other parameters, which are
usually referenced and thereby stringified in the widget templates,
lurl() is the proper choice.
-- Christoph
Tim
That's true, I have just created a ticket for that:
https://sourceforge.net/p/turbogears2/tickets/137/
-- Christoph