summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbbangert <none@none>2006-09-14 12:24:06 -0700
committerbbangert <none@none>2006-09-14 12:24:06 -0700
commitd67c734d50c02325b6a84b6b38c560b4af1403df (patch)
treec96371e56e53c9cf1ece13390873704fdf15025a
parent931456cf63e8db6a6f1ecdcfcd08e5f5f7d47588 (diff)
downloadroutes-d67c734d50c02325b6a84b6b38c560b4af1403df.tar.gz
[svn] Minor tweak to default setting, removed unnecessary redundant default setting. Changed several key checks to use 'not in' vs not has_key.
--HG-- branch : trunk
-rw-r--r--routes/base.py6
-rw-r--r--tests/test_functional/test_recognition.py2
2 files changed, 3 insertions, 5 deletions
diff --git a/routes/base.py b/routes/base.py
index 50ee81a..b959d30 100644
--- a/routes/base.py
+++ b/routes/base.py
@@ -158,9 +158,9 @@ class Route(object):
"""
defaults = {}
# Add in a controller/action default if they don't exist
- if 'controller' not in routekeys and not kargs.has_key('controller'):
+ if 'controller' not in routekeys and 'controller' not in kargs:
kargs['controller'] = 'content'
- if 'action' not in routekeys and not kargs.has_key('action'):
+ if 'action' not in routekeys and 'action' not in kargs:
kargs['action'] = 'index'
defaultkeys = frozenset([key for key in kargs.keys() if key not in reserved_keys])
for key in defaultkeys:
@@ -170,8 +170,6 @@ class Route(object):
defaults[key] = None
if 'action' in routekeys and not defaults.has_key('action'):
defaults['action'] = 'index'
- elif not defaults.has_key('action') and 'controller' in maxkeys:
- defaults['action'] = 'index'
if 'id' in routekeys and not defaults.has_key('id'):
defaults['id'] = None
newdefaultkeys = frozenset([key for key in defaults.keys() if key not in reserved_keys])
diff --git a/tests/test_functional/test_recognition.py b/tests/test_functional/test_recognition.py
index 51acb27..260380d 100644
--- a/tests/test_functional/test_recognition.py
+++ b/tests/test_functional/test_recognition.py
@@ -20,7 +20,7 @@ class TestRecognition(unittest.TestCase):
self.assertEqual(None, m.match('/hello/world/how/are'))
self.assertEqual(None, m.match('/hello/world/how/are/you/today'))
self.assertEqual({'controller':'content','action':'index'}, m.match('/hello/world/how/are/you'))
-
+
def test_basic_dynamic(self):
for path in ['hi/:name', 'hi/:(name)']:
m = Mapper()