[Jifty-commit] jifty branch, master, updated. 86515c116edba0d1ae170c40703c7850231950b6

Jifty commits jifty-commit at lists.jifty.org
Tue Jan 5 17:40:51 EST 2010


The branch, master has been updated
       via  86515c116edba0d1ae170c40703c7850231950b6 (commit)
       via  eedf3e591640a3f3352e8752e89e029dfaa8fbd9 (commit)
       via  5f115652b185c80e8ee12028b33bff05e55e7bfc (commit)
       via  d3af5b38b7dbf0856bd4cf551c91dd695b269cb3 (commit)
       via  b945b16cb41ce0b6b321afec17837ba89083d841 (commit)
       via  01b0f93af8b38f2581f1a6b9e5aa8cff9cf2f793 (commit)
       via  ada217c650904ace679630b2761b34c5284a1e62 (commit)
       via  323f240ca093774aeddf01a58ce64c41c4b5d51c (commit)
       via  00de4b5d897171e3bf27a762a5d3e793b58a1469 (commit)
      from  712a9169e68ca1019678177a1c0ad376f88108c9 (commit)

Summary of changes:
 META.yml                                           |    9 +--
 lib/Jifty.pm                                       |    2 +-
 lib/Jifty/Dispatcher.pm                            |   10 +++-
 lib/Jifty/Handler.pm                               |    5 +-
 lib/Jifty/Plugin/RequestInspector.pm               |   24 +++++++
 lib/Jifty/Plugin/RequestInspector/Model/Request.pm |   14 ++++
 lib/Jifty/Plugin/RequestInspector/View.pm          |   66 ++++++++++++++++++--
 lib/Jifty/Web.pm                                   |    2 +
 lib/Jifty/Web/Form/Field/InlineButton.pm           |    4 +
 9 files changed, 121 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit 00de4b5d897171e3bf27a762a5d3e793b58a1469
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:28:24 2010 -0500

    Need POD for the recently-added render_preamble

diff --git a/lib/Jifty/Web/Form/Field/InlineButton.pm b/lib/Jifty/Web/Form/Field/InlineButton.pm
index a2715d4..981f776 100644
--- a/lib/Jifty/Web/Form/Field/InlineButton.pm
+++ b/lib/Jifty/Web/Form/Field/InlineButton.pm
@@ -27,6 +27,10 @@ Don't show a wrapper for an inline button
 
 Don't show a wrapper for an inline button
 
+=head2 render_preamble
+
+Don't show a label for an inline button
+
 =head2 render_label
 
 Don't show a label for an inline button

commit 323f240ca093774aeddf01a58ce64c41c4b5d51c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:25:48 2010 -0500

    Document add_request and last_id

diff --git a/lib/Jifty/Plugin/RequestInspector.pm b/lib/Jifty/Plugin/RequestInspector.pm
index 65d2bba..139273f 100644
--- a/lib/Jifty/Plugin/RequestInspector.pm
+++ b/lib/Jifty/Plugin/RequestInspector.pm
@@ -226,6 +226,14 @@ to RequestInspector plugins.
 
 Clears the list of request inspections.
 
+=head2 add_request
+
+Adds the current request inspection to the data store.
+
+=head2 last_id
+
+Returns the most recent request ID.
+
 =head2 get_plugin_data RequestID, Plugin::Name
 
 Returns the B<opaque> plugin data for a particular request ID and plugin class
@@ -252,5 +260,9 @@ Instantiates a new request inspection, setting up some defalt values.
 Decides whether the request described by the CGI parameter should be handled,
 based on plugin configuration.
 
+=head2 version
+
+This plugin is versioned because it provides model classes.
+
 =cut
 

commit ada217c650904ace679630b2761b34c5284a1e62
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:28:03 2010 -0500

    Make pod tests happy with requestinspector's model

diff --git a/lib/Jifty/Plugin/RequestInspector/Model/Request.pm b/lib/Jifty/Plugin/RequestInspector/Model/Request.pm
index 738a84f..5efdae8 100644
--- a/lib/Jifty/Plugin/RequestInspector/Model/Request.pm
+++ b/lib/Jifty/Plugin/RequestInspector/Model/Request.pm
@@ -17,3 +17,17 @@ sub since { '0.0.2' }
 
 1;
 
+__END__
+
+=head1 NAME
+
+Jifty::Plugin::RequestInspector::Model::Request - Persistent storage for the request inspector
+
+=head1 METHODS
+
+=head2 since
+
+This model has existed since version 0.0.2 of the RequestInspector
+plugin.
+
+=cut

commit 01b0f93af8b38f2581f1a6b9e5aa8cff9cf2f793
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 16:22:51 2010 -0500

    RequestInspector: Add an aggregate rendering view

diff --git a/lib/Jifty/Plugin/RequestInspector.pm b/lib/Jifty/Plugin/RequestInspector.pm
index 139273f..5c90c8a 100644
--- a/lib/Jifty/Plugin/RequestInspector.pm
+++ b/lib/Jifty/Plugin/RequestInspector.pm
@@ -116,6 +116,13 @@ sub get_plugin_data {
     return $self->get_request($id)->{plugin_data}{$plugin};
 }
 
+sub get_all_plugin_data {
+    my $self   = shift;
+    my $plugin = shift;
+
+    return map {$_->{plugin_data}{$plugin}} $self->requests;
+}
+
 sub new_request_inspection {
     my ($self, $cgi) = @_;
 
@@ -239,6 +246,11 @@ Returns the most recent request ID.
 Returns the B<opaque> plugin data for a particular request ID and plugin class
 name.
 
+=head2 get_all_plugin_data Plugin::Name
+
+Returns the B<opaque> plugin data for all requests, for a given plugin
+class name.
+
 =head2 get_request RequestID
 
 Returns all data for a particular request ID.
diff --git a/lib/Jifty/Plugin/RequestInspector/View.pm b/lib/Jifty/Plugin/RequestInspector/View.pm
index c61f0b5..a67a267 100644
--- a/lib/Jifty/Plugin/RequestInspector/View.pm
+++ b/lib/Jifty/Plugin/RequestInspector/View.pm
@@ -7,6 +7,11 @@ template '/__jifty/admin/requests' => page {
     title => "Request Inspector"
 }
 content {
+    render_region(
+        name => 'aggregate',
+        path => '/__jifty/admin/requests/aggregate',
+    );
+
     h2 { "Request Inspector" };
 
     render_region(
@@ -17,12 +22,17 @@ content {
     div {
         hyperlink(
             label => "Clear requests",
-            onclick => {
-                refresh => 'request_inspector',
-                args => {
-                    clear_requests => 1,
+            onclick => [
+                {
+                    refresh => 'request_inspector',
+                    args => {
+                        clear_requests => 1,
+                    },
                 },
-            },
+                {
+                    refresh => "aggregate",
+                }
+            ],
         ),
     };
 };
@@ -61,6 +71,9 @@ template '/__jifty/admin/requests/more_button' => sub {
         },
         {
             refresh_self => 1,
+        },
+        {
+            refresh => "aggregate",
         }],
     );
 };
@@ -76,6 +89,49 @@ template '/__jifty/admin/requests/more_requests' => sub {
     }
 };
 
+template '/__jifty/admin/requests/aggregate' => sub {
+    my $request_inspector = Jifty->find_plugin('Jifty::Plugin::RequestInspector');
+    my @aggregates = grep {$_->can('inspect_render_aggregate')} $request_inspector->inspector_plugins;
+    return unless @aggregates;
+
+    h2 { "Aggregate information" };
+    dl {
+        for my $plugin (@aggregates) {
+            my $plugin_name = ref $plugin;
+            (my $short_name = $plugin_name) =~ s/^Jifty::Plugin:://;
+            dt {
+                hyperlink(
+                    label => $short_name,
+                    onclick => {
+                        region => Jifty->web->qualified_region($plugin_name),
+                        replace_with => '/__jifty/admin/requests/aggregate_plugin',
+                        toggle => 1,
+                        effect => 'slideDown',
+                        arguments => {
+                            plugin_name => $plugin_name,
+                        },
+                    },
+                );
+            };
+            dd {
+                render_region($plugin_name);
+            };
+        }
+    }
+};
+
+template '/__jifty/admin/requests/aggregate_plugin' => sub {
+    my $plugin_name = get('plugin_name');
+
+    my $request_inspector = Jifty->find_plugin('Jifty::Plugin::RequestInspector');
+    my @plugin_data = $request_inspector->get_all_plugin_data($plugin_name);
+
+    my $plugin = Jifty->find_plugin($plugin_name)
+        or abort(404);
+
+    $plugin->inspect_render_aggregate(@plugin_data);
+};
+
 template '/__jifty/admin/requests/plugins' => sub {
     my $id = get('id');
     my $request_inspector = Jifty->find_plugin('Jifty::Plugin::RequestInspector');

commit b945b16cb41ce0b6b321afec17837ba89083d841
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 16:39:18 2010 -0500

    Add more triggers for inspection

diff --git a/lib/Jifty/Dispatcher.pm b/lib/Jifty/Dispatcher.pm
index e6e874a..8ba3804 100644
--- a/lib/Jifty/Dispatcher.pm
+++ b/lib/Jifty/Dispatcher.pm
@@ -517,13 +517,16 @@ sub _handle_stage {
 
     # Set the current stage so that rules can make smarter choices;
     local $CURRENT_STAGE = $stage;
+    Jifty->handler->call_trigger("before_dispatcher_$stage");
 
     eval { $self->_handle_rules( [ $self->rules($stage), @rules ] ); };
     if ( my $err = $@ ) {
         $self->log->warn( ref($err) . " " . "'$err'" )
             if ( $err !~ /^(LAST RULE|ABORT)/ );
+        Jifty->handler->call_trigger("after_dispatcher_$stage");
         return $err =~ /^ABORT/ ? 0 : 1;
     }
+    Jifty->handler->call_trigger("after_dispatcher_$stage");
     return 1;
 }
 
@@ -868,9 +871,11 @@ sub _do_dispatch {
 
     # Close the handle down, so the client can go on their merry way
     unless (Jifty->web->request->is_subrequest) {
+        Jifty->handler->call_trigger("before_flush");
         Jifty->handler->buffer->flush_output;
         close(STDOUT);
         $Jifty::SERVER->close_client_sockets if $Jifty::SERVER;
+        Jifty->handler->call_trigger("after_flush");
     }
 
     # Cleanup
diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index 924e487..034ce87 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -193,6 +193,8 @@ sub handle_request {
         Jifty->web->request( Jifty::Request->new()->fill( $self->cgi ) );
         Jifty->web->response( Jifty::Response->new );
 
+        $self->call_trigger('have_request');
+
         Jifty->api->reset;
         for ( Jifty->plugins ) {
             $_->new_request;
diff --git a/lib/Jifty/Web.pm b/lib/Jifty/Web.pm
index 677dfb2..561ba8b 100644
--- a/lib/Jifty/Web.pm
+++ b/lib/Jifty/Web.pm
@@ -1009,6 +1009,7 @@ sub render_template {
 
     Jifty->handler->buffer->push( private => 1 ) unless $void_context;
 
+    Jifty->handler->call_trigger("before_render_template", $handler, $template);
     eval { $handler->show($template) };
 
     # Handle parse errors
@@ -1016,6 +1017,7 @@ sub render_template {
 
     $content = Jifty->handler->buffer->pop unless $void_context;
 
+    Jifty->handler->call_trigger("after_render_template", $handler, $template, $content);
 
     if ( $err and not (eval { $err->isa('HTML::Mason::Exception::Abort') } or $err =~ /^ABORT/) ) {
         $self->log->fatal("View error: $err") if $err;

commit d3af5b38b7dbf0856bd4cf551c91dd695b269cb3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 16:49:51 2010 -0500

    The dispatcher does its own flush; another is not necessary

diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index 034ce87..c0e6a47 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -208,8 +208,7 @@ sub handle_request {
         unless (Jifty->web->request->return_from_continuation) {
             $self->buffer->out_method(\&Jifty::View::out_method);
             $self->dispatcher->handle_request();
-            $self->buffer->flush_output;
-        } 
+        }
 
         $self->call_trigger('before_cleanup', $args{cgi});
 

commit 5f115652b185c80e8ee12028b33bff05e55e7bfc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:11:09 2010 -0500

    Avoid an unnecessary die/eval in the dispatcher

diff --git a/lib/Jifty/Dispatcher.pm b/lib/Jifty/Dispatcher.pm
index 8ba3804..0b86d08 100644
--- a/lib/Jifty/Dispatcher.pm
+++ b/lib/Jifty/Dispatcher.pm
@@ -881,8 +881,9 @@ sub _do_dispatch {
     # Cleanup
     $self->_handle_stage('CLEANUP');
 
-    # Out to the next dispatcher's cleanup
-    $self->_abort;
+    # Out to the next dispatcher's cleanup; since try/catch using die
+    # is slow, we only do this if we're not in the topmost dispatcher.
+    $self->_abort if $self->{path} ne "/";
 }
 
 =head2 _match CONDITION

commit eedf3e591640a3f3352e8752e89e029dfaa8fbd9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:19:56 2010 -0500

    Update version for Jifty-Plugin-Timing dep

diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index c835cb8..10c1907 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -13,7 +13,7 @@ BEGIN {
     require Time::Local;
 
     # Declare early to make sure Jifty::Record::schema_version works
-    $Jifty::VERSION = '0.91117';
+    $Jifty::VERSION = '1.00105';
 }
 
 =head1 NAME

commit 86515c116edba0d1ae170c40703c7850231950b6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 5 17:28:38 2010 -0500

    META.yml update

diff --git a/META.yml b/META.yml
index 5c74f0e..970ebb7 100644
--- a/META.yml
+++ b/META.yml
@@ -67,11 +67,9 @@ requires:
   DateTime::Locale: 0
   Email::Folder: 0
   Email::LocalDelivery: 0.217
-  Email::MIME: 1.861
+  Email::MIME: 1.9
   Email::MIME::ContentType: 1.012
   Email::MIME::CreateHTML: 0
-  Email::MIME::Creator: 1.45
-  Email::MIME::Modifier: 1.442
   Email::Send: 2.10
   Email::Simple: 2.003
   Email::Simple::Creator: 1.4
@@ -95,7 +93,7 @@ requires:
   IPC::PubSub: 0.23
   IPC::Run3: 0
   JSON::Syck: 0.29
-  Jifty::DBI: 0.58
+  Jifty::DBI: 0.60
   LWP::UserAgent: 0
   List::MoreUtils: 0
   Locale::Maketext::Extract: 0.35
@@ -117,6 +115,7 @@ requires:
   String::Koremutake: 0
   Template::Declare: 0.36
   Test::Base: 0
+  Test::Exception: 0
   Test::LongString: 0
   Test::More: 0.62
   Test::Pod::Coverage: 0
@@ -134,4 +133,4 @@ requires:
   YAML::Syck: 0.71
   perl: 5.8.3
   version: 0
-version: 0.91117
+version: 1.00105

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list