Discussion:
[jifty-devel] Dispatcher woes
Mikko Lipasti
2008-12-02 09:45:52 UTC
Permalink
Hello list,


I'm having problems figuring out how to work with the Dispatcher.

This is what I have in the Dispatcher:


under [ 'blog', 'wiki' ] => [
run {
default model => "MyApp::Model::\u$1";
},
on 'search' => run {
set op => 'search';
},
];

on '**' => show 'dump'; # prints out whats in %ARGS


This is what I expect:

/blog/search: model => 'MyApp::Model::Blog', op => 'search'
/wiki/search: model => 'MyApp::Model::Wiki', op => 'search'

However, what I get is dependant upon the order in which I visit the
pages. Two pages, two possible orderings:

1. /blog/search first
/blog/search: model => 'MyApp::Model::Blog', op => 'search'
/wiki/search: model => 'MyApp::Model::Wiki'

2. /wiki/search first
/wiki/search: model => 'MyApp::Model::Wiki', op => 'search'
/blog/search: model => 'MyApp::Model::Blog'

In both cases, the latter page loses the op arg, in fact the entire on
'search' run block is lost: it isn't triggered at all.


What's going on?


I'm using Jifty-0.80408.


Best,

Mikko
Jesse Vincent
2008-12-02 16:24:43 UTC
Permalink
Post by Mikko Lipasti
Hello list,
I'm having problems figuring out how to work with the Dispatcher.
under [ 'blog', 'wiki' ] => [
run {
default model => "MyApp::Model::\u$1";
},
on 'search' => run {
set op => 'search';
},
];
I'm not sure I'd mix run and on like that.

What happens if you replace run with

on '*' => run {

}
Post by Mikko Lipasti
on '**' => show 'dump'; # prints out whats in %ARGS
/blog/search: model => 'MyApp::Model::Blog', op => 'search'
/wiki/search: model => 'MyApp::Model::Wiki', op => 'search'
However, what I get is dependant upon the order in which I visit the
1. /blog/search first
/blog/search: model => 'MyApp::Model::Blog', op => 'search'
/wiki/search: model => 'MyApp::Model::Wiki'
2. /wiki/search first
/wiki/search: model => 'MyApp::Model::Wiki', op => 'search'
/blog/search: model => 'MyApp::Model::Blog'
In both cases, the latter page loses the op arg, in fact the entire on
'search' run block is lost: it isn't triggered at all.
What's going on?
I'm using Jifty-0.80408.
Best,
Mikko
_______________________________________________
jifty-devel mailing list
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--

Loading...