[jifty-devel] Having some problems with the dispatcher
Bart Bunting
bart at bunting.net.au
Wed Mar 8 20:36:50 EST 2006
Hi again,
Sorry for all the questions. I'm probably doing something wrong here
but can't figure it out. Everything seems to work fine but when I try
and use the dispatcher I don't seem to be able to get it to work.
I've read the Jifty::Dispatcher manpage which suggests adding lines to
the autohandler. I've looked at Wifty which doesn't seem to use an
autohandler other than the default one at all. I'm confused :(.
I'm trying to set things up so that when a url under /img/ is given it
is passed off to another component which will display the image. I'm
also setting an image variable which is essentially the id of a record
in the database.
None of this is that relevant, the real problem seems to be that for
some reason my dispatcher code isn't getting called.
Could someone take a quick look at what I've done and tell me if I'm
doing something stupid :). I'm running the latest cvs Jifty and
Jifty::DBI 0.16.
Thanks,
Bart
My Dispatcher.pm looks like this:
package BestBuds::Dispatcher;
use Jifty::Dispatcher -base;
# images from database
on '/img/*', run {
my $img = $1;
$img =~ s/\.jpg$//;
set image => $img;
show("/img_display");
};
1;
When I try and access the url /img/1.jpg without doing anything to the
autohandler I get the following error which to my understanding
indicates that my Dispatcher isn't being loaded?
INFO - You can connect to your server at http://localhost:8888/
ERROR - 404: user tried to get to img/1.jpg
If I try with the lines at the top of my autohandler as suggested by
the manpage:
Note that I've just copied the default autohandler out of
/usr/local/share/perl/5.8/auto/Jifty/web/templates/ and added the two
suggested lines.
INFO - You can connect to your server at http://localhost:8888/
WARN - 'Can't call method "path" on an undefined value at
/usr/local/share/perl/5.8.7/Jifty/Dispatcher.pm line 422, <DATA> line 16.
'
ERROR - 404: user tried to get to img/1.jpg
WARN - THIS IS UNSAFE ESCAPING at /usr/local/lib/perl/5.8.7/Jifty/Server.pm
line 80.
FATAL - Can't call method "continuation" on an undefined value at
/usr/local/lib/perl/5.8.7/Jifty/Web/Form/Clickable.pm line 102, <DATA> line
16.
Stack:
[/usr/local/lib/perl/5.8.7/Jifty/Web/Form/Clickable.pm:102]
[/usr/local/lib/perl/5.8.7/Jifty/Web.pm:782]
[/usr/local/lib/perl/5.8.7/auto/Jifty/web/templates/dhandler:7]
[/home/bart/jifty/b/BestBuds/web/templates/_elements/wrapper:59]
[/usr/local/lib/perl/5.8.7/auto/Jifty/web/templates/dhandler:10]
[/home/bart/jifty/b/BestBuds/web/templates/autohandler:12]
WARN - Can't call method "continuation" on an undefined value at
/usr/local/lib/perl/5.8.7/Jifty/Web/Form/Clickable.pm line 102, <DATA> line
16.
Stack:
[/usr/local/lib/perl/5.8.7/Jifty/Web/Form/Clickable.pm:102]
[/usr/local/lib/perl/5.8.7/Jifty/Web.pm:782]
[/usr/local/lib/perl/5.8.7/auto/Jifty/web/templates/dhandler:7]
[/home/bart/jifty/b/BestBuds/web/templates/_elements/wrapper:59]
[/usr/local/lib/perl/5.8.7/auto/Jifty/web/templates/dhandler:10]
[/home/bart/jifty/b/BestBuds/web/templates/autohandler:12]
My autohandler:
<%init>
require BestBuds::Dispatcher;
BestBuds::Dispatcher->handle_request;
$r->content_type('text/html; charset=utf-8');
if ($m->base_comp->path =~ m|/_elements/|) {
# Requesting an internal component by hand -- naughty
$m->redirect("/errors/requested_private_component");
}
$m->comp('/_elements/nav');
$m->call_next();
return;
</%init>
More information about the jifty-devel
mailing list