That error sounds familiar... I ran into it when I was starting
development last summer. I can't remember exactly how we solved it.
You were right to define your routes in your AppConfig class. Your
routes in your 2nd example are correctly formatted, as far as I can
tell. However, the error that 'lookup' attribute doesn't exist is an
artefact of the RoutingController not being able to figure out what
action was specified, and defaulting to the 'lookup' method.
I have two guesses as to your problem:
1) you haven't correctly set up your app_cfg.py (can you paste the
file to http://pastebin.ca so I can look at it?).
2) routes aren't playing nicely with the RootController. I've never
fully figured out why, but sometimes the Root controller doesn't like
being used with routes. In my project we only use the root controller
as a stub. Try making another controller to point your routes to.
Hope this helps,
-- Anthony
On 3-Mar-10, at 7:10 AM, Yo'av Moshe wrote:
So I understand that Routes and TG2.1 don't play too well for now...
okay.
I'm in the process of learning the new tricks of TG2, so if I'll feel
comfortable I'll try to dig into it.
I also tried to follow (more or less) Anthony's guide[0] for TG2, but
when I thought I was getting there I got an error about RootController
not having method 'lookup' or something. I'm new to this whole Pylons
thing (coming for TG1.1), so I'm not sure what to do...
Thanks anyway.
Yo'av
[0] http://getmediacore.com/blog/routes-in-turbogears2/
On Feb 27, 6:56 am, Anthony Theocharis <[email protected]>
wrote:
I've implemented Routes in 2.0.x and we're in the process of getting
the bugs ironed out in that branch (http://bitbucket.org/turbogears/
tg-2_0/ ).
I've been asked to work on the 2.1.x branch, and get Routes working
there too, but I just haven't had time to look at the 2.1.x branch;
my company uses 2.0.x, so I had to fix Routes there there for us to
get our last application out the door.
Basically, none of the core TG developers/maintainers actually use
Routes. So it's not so much a priority for them and it's up to those
people that need Routes support to implement it.
If anyone feels brave enough to tackle Routes in 2.1.x before I get
there, check out the patches by me (Anthony Theocharis) in the tg-2.0
branch linked to above, and see if you can apply the concepts to 2.1.
There should be even fewer changes required in 2.1, because I think
the code there is already cleaner.
-- Anthony
On 24-Feb-10, at 8:19 AM, Kevin Horn wrote:
Please try to be patient...a lot of the TG people have been at
PyCon and probably aren't checking their mail much at the moment...
I've never really tried to change the routing setup in TG2, but it
looks like the AppConfig method is the way to go, according to the
docs:http://turbogears.org/2.1/docs/main/RoutesIntegration.html?
highlight=routes
Also, check the controller that you are routing to for "/homepage/
test/this". If it's an ObjectDispatchController that may be
causing your problems. See the above docs page for details.
Kevin Horn
On Tue, Feb 23, 2010 at 6:03 PM, Yo'av Moshe <[email protected]>
wrote:
Sorry but... Anyone?
I'm thinking *someone* must be using routes in TG2 and can shade
some
light... :-(
Yo'av
On Feb 20, 12:38 am, "Yo'av Moshe" <[email protected]> wrote:
Does it work?
I'm finally trying to convert my website from (TG1.0)TG1.1 to
TG2.1...
One of the features I'm liking the most is the use of Routes...
But I
can't get it to work.
I've tried 2 different methods:
1 - Put this in my root.py, above my RootController:
def setup_routes(self):
map = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug'])
map.connect('/homepage/test/this', controller='RootController',
action="index")
map.connect('*url', controller='root',
action='routes_placeholder')
config['routes.map'] = map
Still, /home/test/this returns 404 (though /index is working fine).
2 - Adding setup_routes to my AppConfig object in app_cfg.py:
def setup_routes(self):
map = Mapper(directory=config['pylons.paths']
['controllers'],
always_scan=config['debug'])
map.connect(None, '/homepage/test/this',
controller='root',
action='index')
map.connect('*url',
controller='root',
action='routes_placeholder')
config['routes.map'] = map
Still, only /index works and no /homepage/test/this
I've tried setting controller as 'root' as well as 'RootController'
and 'index'. None of which helped.
What am I missing? When I installed TG2.1 I thought I'd have a
routes.py file right from the quickstart that I can mess with... :(
I tried searching the group's archive, the above ideas was all I
got..
How can mess with my URLs? :p
Thank you!
Yo'av
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to turbogears
[email protected].
For more options, visit this group athttp://groups.google.com/
group/turbogears?hl=en.
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to turbogears
[email protected].
For more options, visit this group athttp://groups.google.com/
group/turbogears?hl=en.
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to turbogears
[email protected].
For more options, visit this group at http://groups.google.com/
group/turbogears?hl=en.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.