[Jifty-commit] r1095 - in jifty/branches/jifty-jsan: . lib/Jifty/Action/Record lib/Jifty/Web/Form

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon May 22 22:32:01 EDT 2006


Author: jesse
Date: Mon May 22 22:31:59 2006
New Revision: 1095

Modified:
   jifty/branches/jifty-jsan/   (props changed)
   jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Create.pm
   jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Delete.pm
   jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Update.pm
   jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm
   jifty/branches/jifty-jsan/lib/Jifty/I18N.pm
   jifty/branches/jifty-jsan/lib/Jifty/Response.pm
   jifty/branches/jifty-jsan/lib/Jifty/Web/Form/Field.pm

Log:
 r13964 at hualien (orig r1085):  alexmv | 2006-05-22 13:13:47 -0400
  r13088 at zoq-fot-pik:  chmrr | 2006-05-22 13:13:37 -0400
   * Don't try to add headers if running from the command line
 
 r13973 at hualien (orig r1089):  audreyt | 2006-05-22 21:49:32 -0400
 * Jifty::I18N: Compatibility fix with "-e _".
 r13974 at hualien (orig r1090):  audreyt | 2006-05-22 21:51:10 -0400
 * Jifty::Action::Record::{Create,Delete,Update}: Localise the result messages
   like "Created" and "Updated".
 r13975 at hualien (orig r1091):  audreyt | 2006-05-22 21:53:12 -0400
 * Jifty::Dispatcher - support for non-capturing [a-z] in shellglobs.
 r13976 at hualien (orig r1092):  audreyt | 2006-05-22 21:56:05 -0400
 * Form Field: localise hints.


Modified: jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Create.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Create.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Create.pm	Mon May 22 22:31:59 2006
@@ -107,7 +107,7 @@
 
 sub report_success {
     my $self = shift;
-    $self->result->message("Created")
+    $self->result->message(_("Created"))
 }
 
 

Modified: jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Delete.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Delete.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Delete.pm	Mon May 22 22:31:59 2006
@@ -72,7 +72,7 @@
 
 sub report_success {
     my $self = shift;
-    $self->result->message("Deleted")
+    $self->result->message(_("Deleted"))
 }
 
 1;

Modified: jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Update.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Update.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Action/Record/Update.pm	Mon May 22 22:31:59 2006
@@ -143,7 +143,7 @@
 
 sub report_success {
     my $self = shift;
-    $self->result->message("Updated")
+    $self->result->message(_("Updated"))
 }
 
 1;

Modified: jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Dispatcher.pm	Mon May 22 22:31:59 2006
@@ -943,7 +943,8 @@
 
 Private function.
 
-Turns a metaexpression containing * and ? into a capturing perl regex pattern.
+Turns a metaexpression containing *, ? into a capturing perl regex pattern.
+Also supports the noncapturing [] notation.
 
 The rules are:
 
@@ -974,6 +975,10 @@
     /foo???bar      # One capture for ???
     /foo??*         # Two captures, one for ?? and one for *
 
+=item *
+
+Character classes C<[a-z]> denote character classes; they are not captured.
+
 =back
 
 =cut
@@ -998,9 +1003,28 @@
         # extra backslashes.
         ( (?: \\ \? )+ )
     }{([^/]{${ \( length($1)/2 ) }})}gx;
+    $glob =~ s{
+        # Brackets denote character classes
+        (
+            \\ \[           # opening
+            (?:             # one or more characters:
+                \\ [^\]]    # ...escaped (but not the closing bracket)
+            |
+                [^\\]       # ...normal
+            )+
+            \\ \]           # closing
+        )
+    }{$self->_unescape($1)}egx;
     $glob;
 }
 
+sub _unescape {
+    my $self = shift;
+    my $text = shift;
+    $text =~ s{\\(.)}{$1}g;
+    return $text;
+}
+
 =head2 template_exists PATH
 
 Returns true if PATH is a valid template inside your template root.

Modified: jifty/branches/jifty-jsan/lib/Jifty/I18N.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/I18N.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/I18N.pm	Mon May 22 22:31:59 2006
@@ -55,6 +55,8 @@
 
     my $lh         = $class->get_handle(@$lang);
     my $loc_method = sub {
+        # Retain compatibility with people using "-e _" etc.
+        return *_ unless @_;
         return undef unless (defined $_[0]);
         $lh->maketext(@_);
     };

Modified: jifty/branches/jifty-jsan/lib/Jifty/Response.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Response.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Response.pm	Mon May 22 22:31:59 2006
@@ -40,7 +40,7 @@
 
 sub add_header {
     my $self = shift;
-     Jifty->handler->apache->header_out( @_ );
+     Jifty->handler->apache->header_out( @_ ) if Jifty->handler->apache;
 
     # This one is so we can get jifty's headers into mason
     # Otherwise we'd have to wrap mason's output layer

Modified: jifty/branches/jifty-jsan/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Web/Form/Field.pm	Mon May 22 22:31:59 2006
@@ -488,7 +488,7 @@
 sub render_hints { 
     my $self = shift;
     Jifty->web->out(
-qq!<span class="hints @{[$self->classes]}">@{[$self->hints || '']}</span>\n!
+qq!<span class="hints @{[$self->classes]}">@{[_($self->hints) || '']}</span>\n!
     );
 
     return '';


More information about the Jifty-commit mailing list