Has anyone experienced problems with running nosetests on contoller,
that is routed to the sub-domain?
Here's what I've got
controller/test.py
class TestController(BaseController):
def get(self):
return True
routing.py
Out of the box
map.connect(':controller/:action/:id')
map.connect(':action/:id', controller='main')
map.connect('*url', controller='template', action='view')
class TestController(TestController):
def test_get(self):
response = self.app.get(url_for(controller='test',
action='get'))
r = response.body
assert_true(r)
This works just fine.
What do i change
map.connect(':controller/:action/:id',
conditions=dict(sub_domain=['my']))
map.connect(':action/:id', controller='main',
conditions=dict(sub_domain=['my']))
map.connect('*url', controller='template', action='view')
I change in routing
map.sub_domains = True
map.sub_domains_ignore = ['www']
map.connect(':controller/:action/:id',
conditions=dict(sub_domain=['my']))
map.connect(':action/:id', controller='main',
conditions=dict(sub_domain=['my']))
map.connect('*url', controller='template', action='view')
And then no matter what i do in test
class TestController(TestController):
def test_get(self):
response = self.app.get(url_for(controller='test',
action='get', sub_domain='my'))
r = response.body
assert_true(r)
Here's what i get
Traceback (most recent call last):
File "\tests\functional\test.py", line 10
, in setUp
self.login('storos', 'explore')
File "\tests\functional\test.py", line 16
, in login
response = self.app.post(url_for(controller='test', action='get',
sub_dom
ain='my'),
File "D:\Python25\lib\site-packages\routes-1.8-py2.5.egg\routes
\util.py", line
205, in url_for
newargs = _screenargs(kargs)
File "D:\Python25\lib\site-packages\routes-1.8-py2.5.egg\routes
\util.py", line
55, in _screenargs
memory_kargs = _subdomain_check(config, memory_kargs)
File "D:\Python25\lib\site-packages\routes-1.8-py2.5.egg\routes
\util.py", line
66, in _subdomain_check
fullhost = config.environ.get('HTTP_HOST') or \
File "D:\Python25\lib\site-packages\routes-1.8-py2.5.egg\routes
\__init__.py",
line 14, in __getattr__
return getattr(self.__shared_state, name)
AttributeError: 'thread._local' object has no attribute 'environ'
I cann't really figure what's going on here.
return h.url_for(controller='tests', action='get', sub_domain='my')
returns a perfectly legal url, so i cann't really see why test cann't
see it as well
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---