Skip to content

Commit

Permalink
* Printing a mapper now includes the Controller/action parameters fro…
Browse files Browse the repository at this point in the history
…m the

  route. Fixes #11.
  • Loading branch information
bbangert committed Jan 17, 2015
1 parent dcdb3f3 commit 4baf958
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Routes Changelog

Release 2.1 (**dev**)
=====================
* Printing a mapper now includes the Controller/action parameters from the
route. Fixes #11.
* Fix regression that didn't allow passing in params 'host', 'protocol', or
'anchor'. They can now be passed in with a trailing '_' as was possible
before commit d1d1742903fa5ca24ef848a6ae895303f2661b2a. Fixes #7.
Expand Down
5 changes: 3 additions & 2 deletions routes/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ def format_methods(r):
else:
return ''

table = [('Route name', 'Methods', 'Path')] + \
[(r.name or '', format_methods(r), r.routepath or '')
table = [('Route name', 'Methods', 'Path', 'Controller', 'action')] + \
[(r.name or '', format_methods(r), r.routepath or '',
r.defaults.get('controller', ''), r.defaults.get('action', ''))
for r in self.matchlist]

widths = [max(len(row[col]) for row in table)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_units/test_mapper_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def test_str(self):
m.connect('entry', '/entries/{id}', controller='entry', action='show')

expected = """\
Route name Methods Path
Route name Methods Path Controller action
/{controller}/{action}
entries /entries
entry /entries/{id}"""
entries /entries entry index
entry /entries/{id} entry show"""

for expected_line, actual_line in zip(expected.splitlines(), str(m).splitlines()):
assert expected_line == actual_line.rstrip()

0 comments on commit 4baf958

Please sign in to comment.