Permalink
Browse files

use request.params, use addroute instead of _registerRoutes

  • Loading branch information...
1 parent aa2c86d commit 40a435ab5ff56cd12903e2098a19a832477fbcfe @mcdonc mcdonc committed Feb 10, 2013
Showing with 4 additions and 3 deletions.
  1. +3 −2 shootout/tests/test_views.py
  2. +1 −1 shootout/views.py
@@ -135,16 +135,17 @@ def test_comment_add_submit_schema_succeed(self):
from shootout.models import Idea
idea = self._addIdea()
self.config.testing_securitypolicy(u'commentator')
- _registerRoutes(self.config)
+ self.config.include('shootout.addroutes')
request = testing.DummyRequest(
- post={
+ params={
'form.submitted': u'Shoot',
'tags': u'abc def, bar',
'text': u'My comment is cool',
'title': u'My comment',
'target': unicode(idea.idea_id),
}
)
+ request.method = 'POST'
user = self._addUser(u'commentator')
result = idea_add(request)
self.assertEqual(result.location, 'http://example.com/ideas/2')
View
@@ -139,7 +139,7 @@ class AddIdeaSchema(formencode.Schema):
@view_config(permission='post', route_name='idea_add',
renderer='templates/idea_add.pt')
def idea_add(request):
- target = request.POST.get('target') or request.GET.get('target')
+ target = request.params.get('target')
session = DBSession()
if target:
target = Idea.get_by_id(target, with_joinedload=False)

0 comments on commit 40a435a

Please sign in to comment.