[Jifty-commit] r6997 - wifty/trunk/lib/Wifty

Jifty commits jifty-commit at lists.jifty.org
Tue May 12 02:32:57 EDT 2009


Author: ruz
Date: Tue May 12 02:32:57 2009
New Revision: 6997

Modified:
   wifty/trunk/lib/Wifty/Dispatcher.pm

Log:
* use new extended current_user_can and error helper to
  issue better errors

Modified: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Dispatcher.pm	(original)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm	Tue May 12 02:32:57 2009
@@ -41,15 +41,16 @@
 
 # Create a page
 on '/create/*', run {
-     set page => $1;
-     set action => Jifty->web->new_action( class => 'CreatePage' );
+    set page => $1;
+    set action => Jifty->web->new_action( class => 'CreatePage' );
 
-     my $p = Wifty::Model::Page->new();
-     if($p->current_user_can('create')) {
-         show("/create");
-     } else {
-         show("/no_such_page");
-     }
+    my $p = Wifty::Model::Page->new;
+    my ($can, $reason) = $p->current_user_can('create');
+    unless ( $can ) {
+        error( create => $reason);
+    } else {
+        show("/create");
+    }
 };
 
 # View or edit a page


More information about the Jifty-commit mailing list