[Jifty-commit] r2245 - in jifty/branches/template-declare: .
lib/Jifty lib/Jifty/Script t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Dec 1 02:38:54 EST 2006
Author: audreyt
Date: Fri Dec 1 02:38:53 2006
New Revision: 2245
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/META.yml
jifty/branches/template-declare/lib/Jifty/Dispatcher.pm
jifty/branches/template-declare/lib/Jifty/Manual/Cookbook.pod
jifty/branches/template-declare/lib/Jifty/Script/Po.pm
jifty/branches/template-declare/t/01-dependencies.t
Log:
* Merge down into template-declare branch.
Modified: jifty/branches/template-declare/META.yml
==============================================================================
--- jifty/branches/template-declare/META.yml (original)
+++ jifty/branches/template-declare/META.yml Fri Dec 1 02:38:53 2006
@@ -42,6 +42,7 @@
Compress::Zlib: 0
Crypt::CBC: 0
Crypt::Rijndael: 0
+ DBD::SQLite: 1.11
Data::Page: 0
Date::Manip: 0
DateTime: 0
Modified: jifty/branches/template-declare/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Dispatcher.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Dispatcher.pm Fri Dec 1 02:38:53 2006
@@ -452,6 +452,7 @@
# XXX TODO: refactor this out somehow?
# We don't want the previous mason request hanging aroudn once we start dispatching
+ no warnings 'once';
local $HTML::Mason::Commands::m = undef;
# Mason introduces a DIE handler that generates a mason exception
# which in turn generates a backtrace. That's fine when you only
@@ -840,8 +841,8 @@
the condition defined by CONDITION.
C<CONDITION> can be a regular expression, a "simple string" with shell
-wildcard characters (C<*> and C<?>) to match against, or an arrayref or hashref
-of those. It should even be nestable.
+wildcard characters (C<*>, C<?>, C<#>, C<[]>, C<{}>) to match against,
+or an arrayref or hashref of those. It should even be nestable.
Arrayref conditions represents alternatives: the match succeeds as soon
as the first match is found.
@@ -942,7 +943,7 @@
$cond =~ s{(?:\\\/)+}{/}g;
$cond =~ s{/$}{};
- my $has_capture = ( $cond =~ / \\ [*?] /x);
+ my $has_capture = ( $cond =~ / \\ [*?#] /x);
if ($has_capture or $cond =~ / \\ [[{] /x) {
$cond = $self->_compile_glob($cond);
}
@@ -983,9 +984,9 @@
Private function.
-Turns a metaexpression containing C<*> and C<?> into a capturing regex pattern.
+Turns a metaexpression containing C<*>, C<?> and C<#> into a capturing regex pattern.
-Also supports the non-capturing C<[]> and C<{}> notation.
+Also supports the non-capturing C<[]>,and C<{}> notation.
The rules are:
@@ -1026,6 +1027,10 @@
=item *
+The C<#> character captures one or more digit characters.
+
+=item *
+
Brackets such as C<[a-z]> denote character classes; they are not captured.
=item *
@@ -1054,6 +1059,10 @@
\\ \*
}{([^/]*)}gx;
$glob =~ s{
+ # The number-sign character matches one or more digits.
+ \\ \#
+ }{(\\d+)}gx;
+ $glob =~ s{
# Consecutive question marks are captured as one unit;
# we do this by capturing them and then repeat the result pattern
# for that many times. The divide-by-two takes care of the
Modified: jifty/branches/template-declare/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Manual/Cookbook.pod (original)
+++ jifty/branches/template-declare/lib/Jifty/Manual/Cookbook.pod Fri Dec 1 02:38:53 2006
@@ -38,12 +38,12 @@
$feed_entry->link( Jifty->web->url . "/posts/" . $post->id );
$feed_entry->issued( $post->created_on );
$feed_entry->summary( $post->body );
- $feed->add_entry($feed_entry);
+ $feed->add_entry( $feed_entry );
}
</%init>
- <% $feed->as_xml |n%>
+ <% $feed->as_xml |n %>
-And add this in C<MyApp/Dispatcher.pm> to make URI look prettier:
+And add this in F<MyApp/Dispatcher.pm> to make URI look prettier:
on qr{^/feed/(atom|rss|rss2)}, run {
set type => $1;
@@ -99,7 +99,7 @@
the easiest one.
If you're using the newly recommeded C<JIfty::DBI::Record schema {}>
-to declare schema, you might find this trick not working at the moment.
+to declare schemas, you might find this trick not working at the moment.
Please override model's C<before_create> method instead:
sub before_create {
@@ -138,9 +138,9 @@
=head2 Run my Jifty app as fascgi in Apache/Lighttpd ?
Jifty provides a really simple way to run the application as a fastcgi
-server. The complete instruction and example is in C<'jifty help
-fastcgi'> for both Apache server and Lighttpd server. (Please cd to
-your app dir before run this command.)
+server. The complete instructions and examples are in C<'jifty help
+fastcgi'> for both Apache servers and Lighttpd servers. (Please C<cd> to
+your app dir before running this command.)
You'll have to install C<CGI::Fast> and C<FCGI> module for this.
@@ -160,7 +160,7 @@
=head2 Pass HTML form input directly to components
-Sometimes, you don't want to take an action based on input from HTML
+Sometimes you don't want to take an action based on input from HTML
forms, but just want to change how the page is displayed, or do
something similarly transient.
@@ -180,38 +180,38 @@
jifty schema --setup
-Jifty would inspect current database and perform proper actions.
-You could give a C<--print> option to see the actual SQL statement:
+Jifty would inspect the current database and perform proper actions.
+You could give a C<--print> option to see the actual SQL statements:
jifty schema --setup --print
=head2 Use different table names than the ones Jifty automatically creates
-In YourApp::Record define a _guess_table_name sub that doesn't
-pluralises or pluralises differently.
+In YourApp::Record, define a C<_guess_table_name> sub that doesn't
+pluralise or pluralises differently.
=head2 How do I perform ajax canonicalization on a given field ?
Asking user to input something in a form is really common in a web
app. For some certain form fields you want them to have a certain
-normalized/canonicalized form in database, and you could do an ajax
-canonicalization in Jifty very easily. Lets say your User model need a
+normalized/canonicalized form in the database, and you could do an ajax
+canonicalization in Jifty very easily. Let's say your User model needs a
canonicalized C<username> field to make sure those names are in
lowercase. All you have to do is to define a method named
-C<canonicalize_username> your Model class, like this:
+C<canonicalize_username> in your Model class, like this:
package MyApp::Model::User;
use base qw(MyApp::Record);
sub canonicalize_username {
my $class = shift;
- my $value = shift
+ my $value = shift;
return lc($value);
}
-If the form is generated by a C<Jifty::Action::Record> -based action
+If the form is generated by a C<Jifty::Action::Record>-based action
(all those autogenerated CRUD actions), then this is all you need to
do. And that is probably 90% of the case. C<Jifty::Action::Record>
would check if there is a method named like C<canonicalize_fieldname>
@@ -220,6 +220,7 @@
it for you.
The ajax canonicalization happens when the input focus leaves that
-field. You would see the effect a bit latter that the value in the
+field. You would see the effect a bit later than the value in the
field is changed.
+Of course, you can apply the same trick to your own Action classes.
Modified: jifty/branches/template-declare/lib/Jifty/Script/Po.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Script/Po.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Script/Po.pm Fri Dec 1 02:38:53 2006
@@ -127,7 +127,8 @@
my $logger =Log::Log4perl->get_logger("main");
foreach my $file (@files) {
- next if $file =~ m{(^|/)\.svn/};
+ next if $file =~ m{(^|/)[\._]svn/};
+ next if $file =~ m{\~$};
next unless $self->_check_mime_type($file );
$logger->info("Extracting messages from '$file'");
$LMExtract->extract_file($file);
Modified: jifty/branches/template-declare/t/01-dependencies.t
==============================================================================
--- jifty/branches/template-declare/t/01-dependencies.t (original)
+++ jifty/branches/template-declare/t/01-dependencies.t Fri Dec 1 02:38:53 2006
@@ -21,7 +21,7 @@
return unless -f $_;
return if $File::Find::dir =~ m!/.svn($|/)!;
return if $File::Find::name =~ /~$/;
- return if $File::Find::name =~ /\.pod$/;
+ return if $File::Find::name =~ /\.(pod|html)$/;
# read in the file from disk
my $filename = $_;
More information about the Jifty-commit
mailing list