[Jifty-commit] r2845 - in jifty/branches/virtual-models: .
lib/Jifty lib/Jifty/Manual
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Feb 26 11:39:03 EST 2007
Author: sterling
Date: Mon Feb 26 11:39:02 2007
New Revision: 2845
Modified:
jifty/branches/virtual-models/ (props changed)
jifty/branches/virtual-models/AUTHORS
jifty/branches/virtual-models/lib/Jifty/Handler.pm
jifty/branches/virtual-models/lib/Jifty/Logger.pm
jifty/branches/virtual-models/lib/Jifty/Manual/Tutorial.pod
jifty/branches/virtual-models/lib/Jifty/Notification.pm
jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm
jifty/branches/virtual-models/lib/Jifty/Upgrade.pm
Log:
merged in latest trunk; no new test failures
Modified: jifty/branches/virtual-models/AUTHORS
==============================================================================
--- jifty/branches/virtual-models/AUTHORS (original)
+++ jifty/branches/virtual-models/AUTHORS Mon Feb 26 11:39:02 2007
@@ -21,6 +21,7 @@
Yves Agostini <agostini at univ-metz.fr>
Agent Zhang <agentzh at gmail.com>
Pawel Murias <pmurias at woobling.org>
+Kevin Falcone <falcone at bestpractical.com>
Andrew Sterling Hanenkamp <sterling at hanenkamp.com>
Edgar Whipple <jifty at misterwhipple.com>
Christian Ternus <ternus at mit.edu>
Modified: jifty/branches/virtual-models/lib/Jifty/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Handler.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Handler.pm Mon Feb 26 11:39:02 2007
@@ -121,7 +121,6 @@
],
comp_root => [
[application => Jifty::Util->absolute_path( Jifty->config->framework('Web')->{'TemplateRoot'} )],
- [jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}],
],
%{ Jifty->config->framework('Web')->{'MasonConfig'} },
);
@@ -132,6 +131,8 @@
push @{ $config{comp_root} }, [ ref($plugin)."-".Jifty->web->serial => $comp_root ];
}
+ push @{ $config{comp_root} }, [jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}];
+
# In developer mode, we want halos, refreshing and all that other good stuff.
if (Jifty->config->framework('DevelMode') ) {
push @{$config{'plugins'}}, 'Jifty::Mason::Halo';
Modified: jifty/branches/virtual-models/lib/Jifty/Logger.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Logger.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Logger.pm Mon Feb 26 11:39:02 2007
@@ -118,10 +118,11 @@
# If the logger has been taken apart by global destruction,
# don't try to use it to log warnings
if (Log::Log4perl->initialized) {
+ my $action = $self->_warning_action(@_);
# @_ often has read-only scalars, so we need to break
# the aliasing so we can remove trailing newlines
my @lines = map {"$_"} @_;
- $logger->warn(map {chomp; $_} @lines);
+ $logger->$action(map {chomp; $_} @lines);
}
elsif ($previous_warning_handler) {
# Fallback to the old handler
@@ -162,6 +163,44 @@
}
}
+=head2 _warning_action
+
+change the Log4Perl action from warn to error|info|etc based
+on the content of the warning.
+
+Added because DBD::Pg throws up NOTICE and other messages
+as warns, and we really want those to be info (or error, depending
+on the code). List based on Postgres documentation
+
+TODO: needs to be smarter than just string matching
+
+returns a valid Log::Log4Perl action, if nothing matches
+will return the default of warn since we're in a __WARN__ handler
+
+=cut
+
+sub _warning_action {
+ my $self = shift;
+ my $warnings = join('', at _);
+
+ my %pg_notices = ('DEBUG\d+' => 'debug',
+ 'INFO' => 'info',
+ 'NOTICE' => 'info',
+ 'WARNING' => 'warn',
+ 'DBD::Pg.+ERROR' => 'error',
+ 'LOG' => 'warn',
+ 'FATAL' => 'fatal',
+ 'PANIC' => 'fatal' );
+
+ foreach my $notice (keys %pg_notices) {
+ if ($warnings =~ /^$notice:/) {
+ return $pg_notices{$notice};
+ }
+ }
+
+ return 'warn';
+}
+
=head1 AUTHOR
Various folks at Best Practical Solutions, LLC.
Modified: jifty/branches/virtual-models/lib/Jifty/Manual/Tutorial.pod
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Manual/Tutorial.pod (original)
+++ jifty/branches/virtual-models/lib/Jifty/Manual/Tutorial.pod Mon Feb 26 11:39:02 2007
@@ -239,7 +239,7 @@
Ok. It's time to initialize MyWeblog's database. By default, Jifty sets up your
application with the SQLite database engine. If you'd rather use PostgreSQL or
-MySQL, you need to add some content to F<etc/jifty.yml>. (See L<Jifty::Config>
+MySQL, you need to add some content to F<etc/config.yml>. (See L<Jifty::Config>
for a bit more information).
# jifty schema --setup
Modified: jifty/branches/virtual-models/lib/Jifty/Notification.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Notification.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Notification.pm Mon Feb 26 11:39:02 2007
@@ -207,6 +207,7 @@
for my $to ( grep {defined} ($self->to, $self->to_list) ) {
if ($to->can('id')) {
next if $currentuser_object_class->can("nobody")
+ and $currentuser_object_class->nobody->id
and $to->id == $currentuser_object_class->nobody->id;
next if $to->id == $currentuser_object_class->superuser->id;
Modified: jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm Mon Feb 26 11:39:02 2007
@@ -89,6 +89,7 @@
# Import Jifty
Jifty::Util->require("Jifty");
Jifty::Util->require("Jifty::Model::Metadata");
+ Jifty->new( no_handle => 1, logger_component => 'SchemaTool',) unless (Jifty->config);
}
=head2 print_help
@@ -148,10 +149,7 @@
# Now try to connect. We trap expected errors and deal with them.
eval {
- Jifty->new(
- no_handle => $no_handle,
- logger_component => 'SchemaTool',
- );
+ Jifty->setup_database_connection( no_handle => $no_handle, logger_component => 'SchemaTool',);
};
if ( $@ =~ /doesn't match (application schema|running jifty) version/i ) {
Modified: jifty/branches/virtual-models/lib/Jifty/Upgrade.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Upgrade.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Upgrade.pm Mon Feb 26 11:39:02 2007
@@ -102,7 +102,7 @@
my @column_info = ( split /,/, $schema );
my @column_names = map { /^\s*(\S+)/ ? $1 : () } @column_info;
- s/^(\s*)\Q$args{column}\E/$1$args{to}/i for @column_info;
+ s/^(\s*)\b\Q$args{column}\E\b/$1$args{to}/i for @column_info;
my $new_schema = $new_create_clause . join( ',', @column_info );
my $copy_columns = join(
More information about the Jifty-commit
mailing list