[jifty-devel] problem with limiting collection in dispatcher.

Matthew Lenz matthew at nocturnal.org
Thu Jul 12 13:19:29 EDT 2007


Making a simple bug tracker app to learn jifty that allows you to
add/list projects and add/list issues with those projects.  When I try
to access /project/1 to get a list of issues jifty complains that I need
to set a value on the limit.  $1 must have a number value or it would
hit the else statement.  I've tried reworking the code and renaming
variables etc but still it complains that i'm not setting a value.  I'm
running the most recent (as of this morning) trunk version of
jifty/jift-dbi.  I've pasted the dispatcher below.

-Matt

----

package Project::Dispatcher;

use Jifty::Dispatcher -base;

before '*' => run {
    if ( Jifty->web->current_user->id ) {
        my $top = Jifty->web->navigation;

        $top->child('Projects' => url => '/project/list');
    }
    elsif ($1 !~ /^login|^signup/) {
        tangent 'login';
    }
};

on '/project/*' => run {
    if ($1 =~ /^\d+$/) {
        my $issues = Project::Model::IssueCollection->new();
        $issues->limit(column => "project", value => $1);

        my $action = Jifty->web->new_action(class => 'CreateIssue');

        set issues    => $issues;
        set action    => $action;
        set parentid  => $1;

        show("/issues");
    }
    else { # eg 'list'
        my $projects = Project::Model::ProjectCollection->new();
        $projects->unlimit();

        my $action = Jifty->web->new_action(class => 'CreateProject');

        set projects => $projects;
        set action   => $action;

        show("/projects");
    }
};

1;



More information about the jifty-devel mailing list