[Jifty-commit] jifty branch, autocomplete-refactor, created. c893db57491b7bced53102262dd87ad2ee4cc3da

Jifty commits jifty-commit at lists.jifty.org
Mon Mar 22 13:28:57 EDT 2010


The branch, autocomplete-refactor has been created
        at  c893db57491b7bced53102262dd87ad2ee4cc3da (commit)

- Log -----------------------------------------------------------------
commit 3bc507fde235d21d92f704722098568d8270c3ef
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 5 13:14:03 2010 +0800

    Moosing packages in 01-test-web.t

diff --git a/t/01-test-web.t b/t/01-test-web.t
index 4304ce0..86f1f22 100644
--- a/t/01-test-web.t
+++ b/t/01-test-web.t
@@ -22,9 +22,11 @@ isa_ok( $web->response, "Jifty::Response" );
 
 {
     package Jifty::Request::Subclass;
+    use Any::Moose;
     use base qw(Jifty::Request);
 
     package Jifty::Response::Subclass;
+    use Any::Moose;
     use base qw(Jifty::Response);
 }
 

commit fa0386fd00428e4334d77e693e42846d9df1fc62
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 5 14:38:23 2010 +0800

    kill Jifty::Script::ModPerl5

diff --git a/lib/Jifty/Script/ModPerl2.pm b/lib/Jifty/Script/ModPerl2.pm
deleted file mode 100755
index 2d3ca1f..0000000
--- a/lib/Jifty/Script/ModPerl2.pm
+++ /dev/null
@@ -1,72 +0,0 @@
-package Jifty::Script::ModPerl2;
-use strict;
-use warnings;
-
-use Apache2::Const -compile => qw(OK);
-use Jifty::Everything;
-use CGI;
-
-# XXX: can we turn it into a command line script and at the same time use it as
-# as handler?
-
-=head1 NAME
-
-Jifty::Script::ModPerl2 - a ModPerl2 handler for your jifty app.
-
-=head1 SYNOPSIS
-
-    <VirtualHost *:80>
-        DocumentRoot /path/to/base/dir/of/app
-        SetHandler perl-script
-        PerlHandler Jifty::Script::ModPerl2
-    </VirtualHost>
-
-Not a command line script. Read --man for more info.
-
-=head1 DESCRIPTION
-
-This handler should be used with Apache2 and ModPerl2.  It requires the
-DocumentRoot of its VirtualHost to be set to the base directory of your
-jifty application.
-
-Here is the relevant minimal httpd.conf section:
-
-  <VirtualHost *:80>
-    DocumentRoot /path/to/base/dir/of/app
-    SetHandler perl-script
-    PerlHandler Jifty::Script::ModPerl2
-  </VirtualHost>
-
-It would not necessarily need to be a VirtualHost- could be a Directory,
-and should configure about the same.
-
-TODO: This should be set up to serv the static files without mod_perl.
-
-=head1 METTHODS
-
-=head2 handler
-
-The mod_perl handler for the app
-
-=cut
-
-sub handler {
-
-    ##
-    # Fire up jifty
-    chdir($ENV{'DOCUMENT_ROOT'});
-    Jifty->new() unless (Jifty->handler());
-
-    ##
-    # Fix the path to work with CGI
-    $ENV{'PATH_INFO'} = $ENV{'REQUEST_URI'};
-    my $cgi = new CGI;
-
-    Jifty->handler->handle_request(cgi => $cgi);
-
-    ##
-    # Oll Korrect
-    return Apache2::Const::OK;
-}
-
-1;

commit 87dd4c7385010fac05d54c3df6110cd934062044
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 5 20:38:13 2010 +0800

    add server_ready sub so we can print banner

diff --git a/lib/Jifty/Script/Server.pm b/lib/Jifty/Script/Server.pm
index 5e9806f..6e33347 100755
--- a/lib/Jifty/Script/Server.pm
+++ b/lib/Jifty/Script/Server.pm
@@ -194,7 +194,15 @@ sub _run_server {
     Jifty->config->framework('Web')->{'Port'} = $self->{port} if $self->{port};
     my $port = Jifty->config->framework('Web')->{'Port'} || 8888;
 
-    my %args = ( port => $port );
+    my %args = (
+        port         => $port,
+        server_ready => sub {
+            Jifty->log->info( 'You can connect to your server at http://'
+                  . ( $self->{host} || 'localhost' )
+                  . ":$port/" );
+        },
+    );
+
     $args{$_} = $self->{$_} for grep defined $self->{$_}, qw/host user group/;
 
     $Jifty::SERVER = Plack::Loader->load('Standalone', %args);

commit f73987bdc6a4e44cdbe11120437abd74182d2b73
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Mar 8 23:03:45 2010 +0800

    use request_uri to render the url and to redirect

diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index e5c65e0..d84ced1 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -223,7 +223,7 @@ sub call {
         if defined $next->parent;
 
     # Redirect to right page if we're not there already
-    Jifty->web->_redirect($next->request->path . "?J:RETURN=" . $next->id);
+    Jifty->web->_redirect(URI->new($next->request->request_uri)->path . "?J:RETURN=" . $next->id);
     return 1;
 }
 
diff --git a/lib/Jifty/Web/Form/Clickable.pm b/lib/Jifty/Web/Form/Clickable.pm
index 9235958..29d2535 100644
--- a/lib/Jifty/Web/Form/Clickable.pm
+++ b/lib/Jifty/Web/Form/Clickable.pm
@@ -476,7 +476,7 @@ sub complete_url {
 
     my %parameters = $self->get_parameters;
 
-    my $url = $self->returns ? Jifty->web->request->top_request->path : $self->url;
+    my $url = $self->returns ? URI->new(Jifty->web->request->request_uri)->path : $self->url;
     if (%parameters) {
         $url .= ( $url =~ /\?/ ) ? ";" : "?";
         $url .= Jifty->web->query_string(%parameters);

commit f14c8b53591413e7b20168758c89aef0121e52b3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 9 20:13:52 2010 +0800

    % is safe character

diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index d84ced1..2cd4630 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -194,7 +194,7 @@ sub call {
     # characters) then warn, because this may cause infinite
     # redirects
     $self->log->warn("Redirect to '@{[$self->request->path]}' contains unsafe characters")
-        if $self->request->path =~ m{[^A-Za-z0-9\-_.!~*'()/?&;+]};
+        if $self->request->path =~ m{[^A-Za-z0-9\-_.!~*'()/?&;+%]};
 
     # Clone our request
     my $request = $self->request->clone;

commit b515628921d922fecb2ab066903c2268107a0af3
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Wed Mar 10 21:18:46 2010 +0800

    Requires newer CGI::Emulate::PSGI

diff --git a/Makefile.PL b/Makefile.PL
index 52e0bfb..9a3c76b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,7 +14,7 @@ requires('Class::Trigger' => '0.13');
 requires('Clone' => '0.27');
 requires('CGI' => '3.30');
 requires('CGI::Cookie::Splitter');
-requires('CGI::Emulate::PSGI');
+requires('CGI::Emulate::PSGI' => 0.06);
 requires('Class::Inspector' => 1.20); # For File::ShareDir on Win32
 requires('Crypt::CBC');
 requires('Crypt::Rijndael');

commit 3bcea064e7087e6f3cd9c54bcaa25613376064cc
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Mar 11 15:48:08 2010 -0500

    Since we inherit "new", don't inline_constructor
    
        Moose warns about this, Mouse does not. O:)

diff --git a/lib/Jifty/Response.pm b/lib/Jifty/Response.pm
index a0607c2..2525f56 100644
--- a/lib/Jifty/Response.pm
+++ b/lib/Jifty/Response.pm
@@ -99,5 +99,5 @@ sub failure {
 }
 
 no Any::Moose;
-__PACKAGE__->meta->make_immutable();
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);
 1;

commit 2d4a432a543bfc64d9b0333d4d0758e6bf6da663
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Thu Mar 18 11:08:44 2010 +0800

    Add additional fastcgi support prereq.

diff --git a/Makefile.PL b/Makefile.PL
index 9a3c76b..93129bc 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -110,6 +110,11 @@ else {
     requires('YAML' => 0.35) unless can_use('YAML::Syck' => 0.71);
 }
 
+feature "FastCGI support" =>
+    -default => 0,
+    recommends('FCGI::ProcManager' => 0.19),
+    ;
+
 feature "Memcached support for serving compressed CSS and JS from Jifty's CAS" =>
     -default => 1,
     recommends('Cache::Memcached' => 1.25),

commit 29e12eb04d7dd18952a540e17477b3cc882db81a
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Mar 18 07:08:36 2010 -0400

    Implement __not/<column>/<value> for /=/search

diff --git a/lib/Jifty/Plugin/REST.pm b/lib/Jifty/Plugin/REST.pm
index 24e0581..1bdeaeb 100644
--- a/lib/Jifty/Plugin/REST.pm
+++ b/lib/Jifty/Plugin/REST.pm
@@ -4,7 +4,7 @@ use warnings;
 package Jifty::Plugin::REST;
 use base qw/Jifty::Plugin/;
 
-our $VERSION = '1.12';
+our $VERSION = '1.13';
 
 =head1 NAME
 
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index 5c490cf..95f855d 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -140,8 +140,18 @@ looking for Tasks with due dates 1999-12-25 OR 2000-12-25, you can use:
 
     /=/search/Task/due/1999-12-25/due/2000-12-25/
 
-There are also some pseudo-columns that affect the results, but are not columns
-that are searched:
+
+There are also some pseudo-columns. They are prefixed by __ to avoid collisions
+with actual column names.
+
+Not:
+
+    .../__not/<column>/<value>
+
+This lets you search for records whose value for the column is NOT equal
+to the specified value.
+
+Ordering:
 
     .../__order_by/<column>
     .../__order_by_asc/<column>
@@ -150,6 +160,8 @@ that are searched:
 These let you change the output order of the results. Multiple '__order_by's
 will be respected.
 
+Pagination:
+
     .../__page/<number>
     .../__per_page/<number>
 
@@ -646,12 +658,6 @@ sub search_items {
     my @pieces = grep {length} split '/', $fragment;
     my $ret = ['search', $model, @pieces];
 
-    # if they provided an odd number of pieces, the last is the output column
-    my $field;
-    if (@pieces % 2 == 1) {
-        $field = pop @pieces;
-    }
-
     # limit to the key => value pairs they gave us
     my $collection = eval { $model->collection_class->new }
         or abort(404);
@@ -703,6 +709,20 @@ sub search_items {
                 );
             }
         },
+        __not => sub {
+            my $column = shift;
+            my $value  = shift @pieces;
+
+            my $canonicalizer = "canonicalize_$column";
+            $value = $record->$canonicalizer($value)
+                if $record->can($canonicalizer);
+
+            $collection->limit(
+                column   => $column,
+                value    => $value,
+                operator => '!=',
+            );
+        },
     );
 
     # this was called __limit before it was generalized
@@ -715,7 +735,7 @@ sub search_items {
     $special{__order_by_asc}  = $special{__order_by};
     $special{__order_by_desc} = sub { $special{__order_by}->($_[0], 'DESC') };
 
-    while (@pieces) {
+    while (@pieces > 1) {
         my $column = shift @pieces;
         my $value  = shift @pieces;
 
@@ -731,6 +751,12 @@ sub search_items {
         }
     }
 
+    # if they provided an odd number of pieces, the last is the output column
+    my $field;
+    if (@pieces) {
+        $field = shift @pieces;
+    }
+
     if (defined($per_page) || defined($current_page)) {
         $per_page = 15 unless defined $per_page;
         $current_page = 1 unless defined $current_page;
diff --git a/t/TestApp-Plugin-REST/t/02-basic-use.t b/t/TestApp-Plugin-REST/t/02-basic-use.t
index 5ac2e0e..3314508 100644
--- a/t/TestApp-Plugin-REST/t/02-basic-use.t
+++ b/t/TestApp-Plugin-REST/t/02-basic-use.t
@@ -9,7 +9,7 @@ This is a template for your own tests. Copy it and modify it.
 
 =cut
 
-use Jifty::Test::Dist tests => 78;
+use Jifty::Test::Dist tests => 80;
 use Jifty::Test::WWW::Mechanize;
 
 my $server  = Jifty::Test->make_server;
@@ -89,6 +89,10 @@ $mech->get_ok('/=/search/user/id/1.yml');
 my $content = get_content();
 is_deeply($content, [{ name => 'test', email => 'test at example.com', id => 1, tasty => undef }]);
 
+$mech->get_ok('/=/search/user/__not/id/1.yml');
+$content = get_content();
+is_deeply($content, [{ name => 'moose', email => 'moose at example.com', id => 2, tasty => undef }]);
+
 $mech->get_ok('/=/search/user/id/1/name/test.yml');
 $content = get_content();
 is_deeply($content, [{ name => 'test', email => 'test at example.com', id => 1, tasty => undef }]);

commit 40d1b4d51bcbd09d65c4a1aa270c200ac3212cce
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Mar 18 21:25:02 2010 +0800

    why datetime.css was put in /static/ instead of /static/css before?

diff --git a/share/web/static/datetime.css b/share/web/static/css/datetime.css
similarity index 100%
rename from share/web/static/datetime.css
rename to share/web/static/css/datetime.css

commit 836b32803d0f02eca608463c207c45e7dd4bd49b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 19 06:31:02 2010 +0800

    update code for Hash::Merge 0.12: we can specify_behavior with a name only once

diff --git a/Makefile.PL b/Makefile.PL
index 93129bc..409f2ed 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -50,7 +50,7 @@ requires('HTTP::Cookies');
 requires('HTTP::Date');
 requires('HTTP::Server::Simple' => '0.35');  # HTTP::Server::Simple::CGI
 requires('HTTP::Server::Simple::Recorder');
-requires('Hash::Merge');
+requires('Hash::Merge', '0.12');
 requires('Hash::MultiValue', 0.05);
 requires('Hook::LexWrap');
 requires('IO::Handle::Util');
diff --git a/lib/Jifty/Param/Schema.pm b/lib/Jifty/Param/Schema.pm
index 5eadd49..b0f9385 100644
--- a/lib/Jifty/Param/Schema.pm
+++ b/lib/Jifty/Param/Schema.pm
@@ -168,6 +168,11 @@ use constant MERGE_PARAM_BEHAVIOUR => {
             HASH   => sub { Hash::Merge::_merge_hashes( $_[0], $_[1] ) } }
 };
 
+my $prev_behaviour = Hash::Merge::get_behavior();
+# the behavior name must be upper-case
+Hash::Merge::specify_behavior( MERGE_PARAM_BEHAVIOUR, 'MERGE_PARAMS' );
+Hash::Merge::set_behavior( $prev_behaviour );
+
 =head2 merge_params HASHREF HASHREF
 
 Takes two hashrefs. Merges them together and returns the merged hashref.
@@ -202,7 +207,7 @@ sub merge_params {
     my $prev_behaviour = Hash::Merge::get_behavior();
     my $prev_clone_behaviour = Hash::Merge::get_clone_behavior();
     Hash::Merge::set_clone_behavior(0);
-    Hash::Merge::specify_behavior( MERGE_PARAM_BEHAVIOUR, "merge_params" );
+    Hash::Merge::set_behavior( 'MERGE_PARAMS' );
     my $rv = Hash::Merge::merge(@_);
     Hash::Merge::set_behavior( $prev_behaviour );
     Hash::Merge::set_clone_behavior($prev_clone_behaviour);

commit c893db57491b7bced53102262dd87ad2ee4cc3da
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 19 08:26:24 2010 +0800

    in case request_uri is not set in continuation

diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index 2cd4630..667261b 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -223,7 +223,12 @@ sub call {
         if defined $next->parent;
 
     # Redirect to right page if we're not there already
-    Jifty->web->_redirect(URI->new($next->request->request_uri)->path . "?J:RETURN=" . $next->id);
+    # $next maybe only set path
+    my $path =
+      $next->request->request_uri
+      ? URI->new( $next->request->request_uri )->path
+      : $next->request->path;
+    Jifty->web->_redirect($path . "?J:RETURN=" . $next->id);
     return 1;
 }
 

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


More information about the Jifty-commit mailing list