#2291: Missing index method raises unrecoverable 404 instead of calling the
lookup
method.
------------------------+---------------------------------------------------
Reporter: amcgregor | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: TurboGears | Version: trunk
Severity: major | Keywords:
------------------------+---------------------------------------------------
Howdy!
== Previous Behavior ==
As of b2, I am able to omit the index method from a controller and have
the tree parser automatically call the lookup method with one of '' (an
empty string) or 'index' depending on the presence of a trailing slash.
(The trailing slash issue was filed under a separate ticket some time
ago.)
== Current Behavior ==
Omitting the index method and attempting to request a URL that would
trigger it results in an unrecoverable 404 error.
== Notes ==
My CMF's lookup method was already getting way past gnarly and now it
seems I'll have to hack in a dummy index method, too.
== Steps to Reproduce ==
Use this as the root.py controller in a new quickstart application:
{{{
#!python
# -*- coding: utf-8 -*-
from tg import expose, flash, require, url, request, redirect
from ugtest.lib.base import BaseController
from ugtest.controllers.error import ErrorController
__all__ = ['RootController']
class SampleController(BaseController):
def __init__(self, name):
self.__name = name
super(SampleController, self).__init__()
@expose()
def index(self):
return "Should never get here."
@expose()
def whatsMyName(self):
return self.__name
class RootController(BaseController):
error = ErrorController()
@expose()
def thisWorks(self):
return "This works."
@expose()
def lookup(self, node='shouldBeIndex', *remainder):
return SampleController(node), ['whatsMyName']
}}}
Use the following URLs to test:
{{{
http://localhost:8080/ -- Expected output: "index" -- Actual output: 404
error.
http://localhost:8080/helloWorld/ -- Correct output.
http://localhost:8080/thisWorks -- Correct output.
}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2291>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---