I have a URL with a mandatory ID:
/incident/123
map.connect("incident", "/incident/:orr_id", controller="incident",
action="index", requirements={"orr_id": NUMERIC})
NUMERIC = R"\d+"
This rule is somehow allowing "/incident/" through, causing an
exception in my controller method:
def index(self, orr_id):
TypeError: index() takes exactly 2 arguments (1 given)
So I can give it a default value of None and show an error page if so,
but why isn't the 'requirements' working?
$ paster shell development.ini
In [12]:mapper.match("/incident/123")
Out[12]:{'action': u'index', 'controller': u'incident', 'orr_id': u'123'}
In [13]:mapper.match("/incident/")
Out[13]:{'action': 'index', 'controller': u'incident', 'id': None}
In [14]:mapper.match("/incident")
Out[14]:{'action': 'index', 'controller': u'incident', 'id': None}
--
Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---