~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/urls/__init__.py

  • Committer: William Grant
  • Date: 2009-07-04 04:42:08 UTC
  • mto: (1294.4.2 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20090704044208-sykidit1yjazl4a2
Always raise a NotFound if the path doesn't resolve to a view.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
                if len(todo) == 0:
227
227
                    view = self.vmap[type(obj)][viewset].get(self.default)
228
228
                    if view is not None:
229
 
                        return (obj, view, tuple(todo[1:]))
 
229
                        return (obj, view, ())
230
230
                    else:
231
231
                        # No segments, no default view. Erk.
232
 
                        break
 
232
                        raise NotFound(obj, '+index', ())
233
233
                view = self.vmap[type(obj)][viewset].get(todo[0])
234
234
                if view is not None:
235
235
                    return (obj, view, tuple(todo[1:]))
236
236
 
237
237
            if len(todo) == 0:
238
238
                # Nothing left, no views at all. Die.
239
 
                break
 
239
                # XXX: This must be able to be merged into the one up there.
 
240
                raise NotFound(obj, '+index', ())
240
241
 
241
242
            # Check if we have any routes for this object at all.
242
243
            try:
243
244
                names = self.fmap[type(obj)]
244
245
            except KeyError:
245
 
                break
 
246
                # XXX: This one should be merged too.
 
247
                raise NotFound(obj, '+index', ())
246
248
 
247
249
            routebits = names.get(todo[0])
248
250
 
270
272
                        args = todo[:argc]
271
273
                        todo = todo[argc:]
272
274
                else:
273
 
                    raise NotFound(obj, todo[0])
 
275
                    raise NotFound(obj, todo[0], todo[1:])
274
276
 
275
277
            if argc is not INF and len(args) != argc:
276
278
                # There were too few path segments left. Die.
277
279
                raise InsufficientPathSegments(obj, lastseg, len(args))
278
280
 
279
281
            obj = route(obj, *args)
280
 
        return (obj, None, tuple(todo))
281
282