Hi,
I want to test a view, but the matchdict doesn't get set up. The
application works when I use it via a web browser.
The route configuration:
config.add_route('newsletter_create_issue', '%s/createissue/{templateid}' %
root_path)
In the test case (the test suite is set up with their own registry):
def test_getting_an_issue_list(self):
from pyramid import request
# the same code is in the route configuration, with the number being
# a parameter in that view:
path = '/' + root_path + '/createissue/1'
req = request.Request.blank(path)
req.registry = self.config.registry
# The following bails out, due to the code shown below:
result = getNewsletterIssues(req, 1) # BOOM!
def getNewsletterIssues(request, id_):
...
tid = int(request.matchdict['templateid'])
The traceback:
...
tid = int(request.matchdict['templateid'])
TypeError: 'NoneType' object is unsubscriptable
What am I doing wrong?
TIA!
Kind regards,
--Toni++
--
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.