[Jifty-commit] r4427 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Nov 13 13:37:29 EST 2007
Author: alexmv
Date: Tue Nov 13 13:37:29 2007
New Revision: 4427
Modified:
jifty/trunk/ (props changed)
jifty/trunk/Makefile.PL
jifty/trunk/lib/Jifty/Collection.pm
jifty/trunk/lib/Jifty/Record.pm
Log:
r24696 at zoq-fot-pik: chmrr | 2007-11-13 13:36:31 -0500
* POD re-wrapping
* perltidy
* Use Jifty::DBI's new ->_new_record_args and _new_collection_args
* Bump the JDBI dep accordingly
Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL (original)
+++ jifty/trunk/Makefile.PL Tue Nov 13 13:37:29 2007
@@ -50,7 +50,7 @@
requires('Hook::LexWrap');
requires('IPC::PubSub' => '0.23' );
requires('IPC::Run3');
-requires('Jifty::DBI' => '0.45' ); # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
+requires('Jifty::DBI' => '0.47' ); # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
requires('Locale::Maketext::Extract' => '0.20');
requires('Locale::Maketext::Lexicon' => '0.60');
requires('Log::Log4perl' => '1.04');
Modified: jifty/trunk/lib/Jifty/Collection.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Collection.pm (original)
+++ jifty/trunk/lib/Jifty/Collection.pm Tue Nov 13 13:37:29 2007
@@ -39,15 +39,16 @@
Returns a L<Data::Page> object associated with this collection. This
object defaults to 10 entries per page. You should use only use
-L<Data::Page> methods on this object to B<get> information about paging,
-not to B<set> it; use C<set_page_info> to set paging information.
+L<Data::Page> methods on this object to B<get> information about
+paging, not to B<set> it; use C<set_page_info> to set paging
+information.
=head2 results_are_readable
If your results from the query are guaranteed to be readable by
current_user, you can create the collection with
-C<results_are_readable => 1>. This causes check_read_rights to
-bypass normal current_user_can checks.
+C<results_are_readable => 1>. This causes check_read_rights to bypass
+normal current_user_can checks.
=cut
@@ -55,9 +56,11 @@
=head2 as_search_action PARAMHASH
-Returns the L<Jifty::Action::Record::Search> action for the model associated with this collection.
+Returns the L<Jifty::Action::Record::Search> action for the model
+associated with this collection.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
@@ -68,15 +71,16 @@
=head2 add_record
-If L</results_are_readable> is false, only add records to the collection that
-we can read (by checking L<Jifty::Record/check_read_rights>). Otherwise, make
-sure all records added are readable.
+If L</results_are_readable> is false, only add records to the
+collection that we can read (by checking
+L<Jifty::Record/check_read_rights>). Otherwise, make sure all records
+added are readable.
=cut
sub add_record {
my $self = shift;
- my($record) = (@_);
+ my ($record) = (@_);
# If results_are_readable is set, guarantee that they are
$record->_is_readable(1)
@@ -98,24 +102,24 @@
sub _init {
my $self = shift;
my %args = (
- record_class => undef,
- current_user => undef,
+ record_class => undef,
+ current_user => undef,
results_are_readable => undef,
@_
);
# Setup the current user, record class, results_are_readable
$self->_get_current_user(%args);
- $self->record_class($args{record_class}) if defined $args{record_class};
- $self->results_are_readable($args{results_are_readable});
+ $self->record_class( $args{record_class} ) if defined $args{record_class};
+ $self->results_are_readable( $args{results_are_readable} );
# Bad stuff, we really need one of these
- unless ($self->current_user) {
+ unless ( $self->current_user ) {
Carp::confess("Collection created without a current user");
}
# Setup the table and call the super-implementation
- $self->table($self->new_item->table());
+ $self->table( $self->new_item->table() );
$self->SUPER::_init(%args);
}
@@ -127,22 +131,17 @@
sub implicit_clauses {
my $self = shift;
- $self->order_by( column => 'id',order => 'asc');
+ $self->order_by( column => 'id', order => 'asc' );
}
-=head2 new_item
-
-Overrides L<Jifty::DBI::Collection>'s new_item to pass in the current
-user.
-
-=cut
-
-sub new_item {
+sub _new_record_args {
my $self = shift;
- my $class =$self->record_class();
+ return ( current_user => $self->current_user );
+}
- # We do this as a performance optimization, so we don't need to do the stackwalking to find it
- return $class->new(current_user => $self->current_user);
+sub _new_collection_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
}
=head1 SEE ALSO
Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm (original)
+++ jifty/trunk/lib/Jifty/Record.pm Tue Nov 13 13:37:29 2007
@@ -24,9 +24,8 @@
my $self = shift;
my %args = (@_);
$self->_get_current_user(%args);
-
- $self->SUPER::_init(@_);
+ $self->SUPER::_init(@_);
}
=head1 METHODS
@@ -37,8 +36,8 @@
C<create> can be called as either a class method or an object method.
-Takes an array of key-value pairs and inserts a new row into the database representing
-this object.
+Takes an array of key-value pairs and inserts a new row into the
+database representing this object.
Override's L<Jifty::DBI::Record> in these ways:
@@ -122,9 +121,8 @@
=cut
-sub _primary_key { 'id' }
-sub id { $_[0]->{'values'}->{'id'} }
-
+sub _primary_key {'id'}
+sub id { $_[0]->{'values'}->{'id'} }
=head2 load_or_create
@@ -137,8 +135,8 @@
sub load_or_create {
my $class = shift;
my $self;
- if (ref($class)) {
- ($self,$class) = ($class,undef);
+ if ( ref($class) ) {
+ ( $self, $class ) = ( $class, undef );
} else {
$self = $class->new();
}
@@ -150,44 +148,47 @@
return $self->create(%args);
}
- return ($id,$msg);
+ return ( $id, $msg );
}
-
=head2 as_create_action PARAMHASH
-Returns the L<Jifty::Action::Record::Create> action for this model class.
+Returns the L<Jifty::Action::Record::Create> action for this model
+class.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub _action_from_record {
- my $self = shift;
- my $verb = shift;
+ my $self = shift;
+ my $verb = shift;
my $class = ref $self || $self;
$class =~ s/::Model::/::Action::$verb/;
return $class;
}
sub as_create_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Create');
return Jifty->web->new_action( class => $action_class, @_ );
}
=head2 as_update_action PARAMHASH
-Returns the L<Jifty::Action::Record::Update> action for this model class. The current record is passed to the constructor.
+Returns the L<Jifty::Action::Record::Update> action for this model
+class. The current record is passed to the constructor.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_update_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Update');
- return Jifty->web->new_action(
+ return Jifty->web->new_action(
class => $action_class,
record => $self,
@_,
@@ -196,14 +197,16 @@
=head2 as_delete_action PARAMHASH
-Returns the L<Jifty::Action::Record::Delete> action for this model class. The current record is passed to the constructor.
+Returns the L<Jifty::Action::Record::Delete> action for this model
+class. The current record is passed to the constructor.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_delete_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Delete');
return Jifty->web->new_action(
class => $action_class,
@@ -214,35 +217,40 @@
=head2 as_search_action PARAMHASH
-Returns the L<Jifty::Action::Record::Search> action for this model class.
+Returns the L<Jifty::Action::Record::Search> action for this model
+class.
-The PARAMHASH allows you to add additional parameters to pass to L<Jifty::Web/new_action>.
+The PARAMHASH allows you to add additional parameters to pass to
+L<Jifty::Web/new_action>.
=cut
sub as_search_action {
- my $self = shift;
+ my $self = shift;
my $action_class = $self->_action_from_record('Search');
return Jifty->web->new_action(
- class => $action_class,
+ class => $action_class,
@_,
);
}
=head2 _guess_table_name
-Guesses a table name based on the class's last part. In addition to the work performed in L<Jifty::DBI::Record>, this method also prefixes the table name with the plugin table prefix, if the model belongs to a plugin.
+Guesses a table name based on the class's last part. In addition to
+the work performed in L<Jifty::DBI::Record>, this method also prefixes
+the table name with the plugin table prefix, if the model belongs to a
+plugin.
=cut
sub _guess_table_name {
- my $self = shift;
+ my $self = shift;
my $table = $self->SUPER::_guess_table_name;
# Add plugin table prefix if a plugin model
my $class = ref($self) ? ref($self) : $self;
my $app_plugin_root = Jifty->app_class('Plugin');
- if ($class =~ /^(?:Jifty::Plugin::|$app_plugin_root)/) {
+ if ( $class =~ /^(?:Jifty::Plugin::|$app_plugin_root)/ ) {
# Guess the plugin class name
my $plugin_class = $class;
@@ -252,13 +260,14 @@
my ($plugin) = grep { ref $_ eq $plugin_class } Jifty->plugins;
# Add the prefix if found
- if (defined $plugin) {
+ if ( defined $plugin ) {
$table = $plugin->table_prefix . $table;
}
# Uh oh. Warn, but try to keep going.
else {
- warn "Model $class looks like a plugin model, but $plugin_class could not be found.";
+ warn
+ "Model $class looks like a plugin model, but $plugin_class could not be found.";
}
}
@@ -296,7 +305,8 @@
=back
-Models wishing to customize authorization checks should override this method. You can do so like this:
+Models wishing to customize authorization checks should override this
+method. You can do so like this:
sub current_user_can {
my ($self, $right, %args) = @_;
@@ -309,7 +319,9 @@
return $self->SUPER::current_user_can($right, %args);
}
-If you are sure you don't want your model to fallback using the default implementation, you can replace the last line with whatever fallback policy required.
+If you are sure you don't want your model to fallback using the
+default implementation, you can replace the last line with whatever
+fallback policy required.
=head3 Authorization steps
@@ -319,24 +331,25 @@
=item 1.
-If the C<SkipAccessControl> setting is set to a true value in the framework configuration section of F<etc/config.yml>, C<current_user_can> always returns true.
+If the C<SkipAccessControl> setting is set to a true value in the
+framework configuration section of F<etc/config.yml>,
+C<current_user_can> always returns true.
=item 2.
-The method first attempts to call the C<before_access> hooks to check for any
-allow or denial. See L</The before_access hook>.
+The method first attempts to call the C<before_access> hooks to check
+for any allow or denial. See L</The before_access hook>.
=item 3.
Next, the default implementation returns true if the current user is a
-superuser or a boostrap user.
+superuser or a boostrap user.
=item 4.
Then, if the model can perform delegation, usually by using
-L<Jifty::RightsFrom>, the access control decision is deferred to another object
-(via the C<delegate_current_user_can>
-subroutine).
+L<Jifty::RightsFrom>, the access control decision is deferred to
+another object (via the C<delegate_current_user_can> subroutine).
=item 5.
@@ -346,7 +359,9 @@
=head3 The before_access hook
-This implementation may make use of a trigger called C<before_access> to make the decision. A new handler can be added to the trigger point by calling C<add_handler>:
+This implementation may make use of a trigger called C<before_access>
+to make the decision. A new handler can be added to the trigger point
+by calling C<add_handler>:
$record->add_trigger(
name => 'before_access',
@@ -354,15 +369,21 @@
abortable => 1,
);
-The C<before_access> handler will be passed the same arguments that were used to call C<current_user_can>, including the current record object, the operation being checked, and any arguments being passed to the operation.
-
-The C<before_access> handler should return one of three strings: C<'deny'>, C<'allow'>, or C<'ignore'>. The C<current_user_can> implementation reacts as follows to these results:
+The C<before_access> handler will be passed the same arguments that
+were used to call C<current_user_can>, including the current record
+object, the operation being checked, and any arguments being passed to
+the operation.
+
+The C<before_access> handler should return one of three strings:
+C<'deny'>, C<'allow'>, or C<'ignore'>. The C<current_user_can>
+implementation reacts as follows to these results:
=over
=item 1.
-If a handler is abortable and aborts by returning a false value (such as C<undef>), C<current_user_can> returns false.
+If a handler is abortable and aborts by returning a false value (such
+as C<undef>), C<current_user_can> returns false.
=item 2.
@@ -370,11 +391,14 @@
=item 3.
-If any handler returns 'allow' and no handler returns 'deny', C<current_user_can> returns true.
+If any handler returns 'allow' and no handler returns 'deny',
+C<current_user_can> returns true.
=item 4.
-In all other cases, the results of the handlers are ignored and C<current_user_can> proceeds to check using superuser, bootstrap, and delegation.
+In all other cases, the results of the handlers are ignored and
+C<current_user_can> proceeds to check using superuser, bootstrap, and
+delegation.
=back
@@ -383,38 +407,38 @@
sub current_user_can {
my $self = shift;
my $right = shift;
-
+
# Turn off access control for the whole application
- if (Jifty->config->framework('SkipAccessControl')) {
- return 1;
+ if ( Jifty->config->framework('SkipAccessControl') ) {
+ return 1;
}
my $hook_status = $self->call_trigger( before_access => $right, @_ );
# If not aborted...
- if (defined $hook_status) {
+ if ( defined $hook_status ) {
# Compile the handler results
my %results;
- $results{ $_->[0] }++ for (@{ $self->last_trigger_results });
+ $results{ $_->[0] }++ for ( @{ $self->last_trigger_results } );
# Deny always takes precedent
- if ($results{deny}) {
+ if ( $results{deny} ) {
return 0;
}
# Then allow...
- elsif ($results{allow}) {
+ elsif ( $results{allow} ) {
return 1;
}
-
+
# Otherwise, no instruction from the handlers, move along...
}
# Abort! Return false for safety
else {
return 0;
- }
+ }
if ( $self->current_user->is_bootstrap_user
or $self->current_user->is_superuser )
@@ -422,12 +446,11 @@
return (1);
}
-
- if ($self->can('delegate_current_user_can')) {
- return $self->delegate_current_user_can($right, @_);
+ if ( $self->can('delegate_current_user_can') ) {
+ return $self->delegate_current_user_can( $right, @_ );
}
- unless ( $self->current_user->isa( 'Jifty::CurrentUser' ) ) {
+ unless ( $self->current_user->isa('Jifty::CurrentUser') ) {
$self->log->error(
"Hm. called to authenticate without a currentuser - "
. $self->current_user );
@@ -443,8 +466,7 @@
=cut
-sub check_create_rights { return shift->current_user_can('create', @_) }
-
+sub check_create_rights { return shift->current_user_can( 'create', @_ ) }
=head2 check_read_rights
@@ -466,8 +488,7 @@
=cut
-sub check_update_rights { return shift->current_user_can('update', @_) }
-
+sub check_update_rights { return shift->current_user_can( 'update', @_ ) }
=head2 check_delete_rights
@@ -475,24 +496,22 @@
=cut
-sub check_delete_rights { return shift->current_user_can('delete', @_) }
-
+sub check_delete_rights { return shift->current_user_can( 'delete', @_ ) }
sub _set {
my $self = shift;
- unless ($self->check_update_rights(@_)) {
- return (0, _('Permission denied'));
+ unless ( $self->check_update_rights(@_) ) {
+ return ( 0, _('Permission denied') );
}
$self->SUPER::_set(@_);
}
-
sub _value {
- my $self = shift;
+ my $self = shift;
my $column = shift;
- unless ($self->check_read_rights( $column => @_ )) {
+ unless ( $self->check_read_rights( $column => @_ ) ) {
return (undef);
}
my $value = $self->SUPER::_value( $column => @_ );
@@ -502,7 +521,6 @@
$value;
}
-
=head2 as_superuser
Returns a copy of this object with the current_user set to the
@@ -514,43 +532,11 @@
sub as_superuser {
my $self = shift;
- my $clone = $self->new(current_user => $self->current_user->superuser);
- $clone->load($self->id);
+ my $clone = $self->new( current_user => $self->current_user->superuser );
+ $clone->load( $self->id );
return $clone;
}
-
-=head2 _collection_value METHOD
-
-A method ripped from the pages of Jifty::DBI::Record
-so we could change the invocation method of the collection generator to
-add a current_user argument.
-
-=cut
-
-sub _collection_value {
- my $self = shift;
-
- my $method_name = shift;
- return unless defined $method_name;
-
- my $column = $self->column($method_name);
- my $classname = $column->refers_to();
-
- return undef unless $classname;
- return unless $classname->isa( 'Jifty::DBI::Collection' );
-
- if ( my $prefetched_collection = $self->_prefetched_collection($method_name)) {
- return $prefetched_collection;
- }
-
- my $coll = $classname->new( current_user => $self->current_user );
- if ($column->by and $self->id) {
- $coll->limit( column => $column->by(), value => $self->id );
- }
- return $coll;
-}
-
=head2 delete PARAMHASH
Overrides L<Jifty::DBI::Record> to check the delete ACL.
@@ -559,11 +545,11 @@
sub delete {
my $self = shift;
- unless ($self->check_delete_rights(@_)) {
- Jifty->log->logcluck("Permission denied");
- return(0, _('Permission denied'));
- }
- $self->SUPER::delete(@_);
+ unless ( $self->check_delete_rights(@_) ) {
+ Jifty->log->logcluck("Permission denied");
+ return ( 0, _('Permission denied') );
+ }
+ $self->SUPER::delete(@_);
}
=head2 brief_description
@@ -573,48 +559,45 @@
=cut
sub brief_description {
- my $self = shift;
+ my $self = shift;
my $method = $self->_brief_description;
return $self->$method;
}
=head2 _brief_description
-When displaying a list of records, Jifty can display a friendly value
+When displaying a list of records, Jifty can display a friendly value
rather than the column's unique id. Out of the box, Jifty always
-tries to display the 'name' field from the record. You can override this
-method to return the name of a method on your record class which will
-return a nice short human readable description for this record.
+tries to display the 'name' field from the record. You can override
+this method to return the name of a method on your record class which
+will return a nice short human readable description for this record.
=cut
sub _brief_description {'name'}
-=head2 _to_record
+=head2 _new_collection_args
-This is the Jifty::DBI function that is called when you fetch a value which C<REFERENCES> a
-Record class. The only change from the Jifty::DBI code is the arguments to C<new>.
+Overrides the default arguments which this collection passes to new
+collections, to pass the C<current_user>.
=cut
-sub _to_record {
- my $self = shift;
- my $column_name = shift;
- my $value = shift;
+sub _new_collection_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
+}
- my $column = $self->column($column_name);
- my $classname = $column->refers_to();
+=head2 _new_record_args
- return undef unless $classname;
- return unless $classname->isa( 'Jifty::Record' );
+Overrides the default arguments which this collection passes to new
+records, to pass the C<current_user>.
+
+=cut
- # XXX TODO FIXME we need to figure out the right way to call new here
- # perhaps the handle should have an initiializer for records/collections
- my $object = $classname->new(current_user => $self->current_user);
- $object->load_by_cols(( $column->by || 'id') => $value) if ($value);
- # XXX: an attribute or hook to let model class declare implicit
- # readable refers_to columns. $object->_is_readable(1) if $column->blah;
- return $object;
+sub _new_record_args {
+ my $self = shift;
+ return ( current_user => $self->current_user );
}
=head2 cache_key_prefix
@@ -624,7 +607,6 @@
=cut
-
sub cache_key_prefix {
Jifty->config->framework('Database')->{'Database'};
}
@@ -636,21 +618,20 @@
}
=head2 since
-
-By default, all models exist since C<undef>, the ur-time when the application was created. Please override it for your model class.
-
-=cut
-
+By default, all models exist since C<undef>, the ur-time when the
+application was created. Please override it for your model class.
+
+=cut
=head2 printable_table_schema
-When called, this method will generate the SQL schema for the current version of this
-class and return it as a scalar, suitable for printing or execution in your database's command line.
+When called, this method will generate the SQL schema for the current
+version of this class and return it as a scalar, suitable for printing
+or execution in your database's command line.
=cut
-
sub printable_table_schema {
my $class = shift;
@@ -660,8 +641,9 @@
=head2 create_table_in_db
-When called, this method will generate the SQL schema for the current version of this
-class and insert it into the application's currently open database.
+When called, this method will generate the SQL schema for the current
+version of this class and insert it into the application's currently
+open database.
=cut
@@ -694,9 +676,10 @@
$ret or die "error removing table $self: " . $ret->error_message;
}
-sub _make_schema {
+sub _make_schema {
my $class = shift;
+ require Jifty::DBI::SchemaGenerator;
my $schema_gen = Jifty::DBI::SchemaGenerator->new( Jifty->handle )
or die "Can't make Jifty::DBI::SchemaGenerator";
my $ret = $schema_gen->add_model( $class->new );
@@ -707,7 +690,8 @@
=head2 add_column_sql column_name
-Returns the SQL statement necessary to add C<column_name> to this class's representation in the database
+Returns the SQL statement necessary to add C<column_name> to this
+class's representation in the database
=cut
@@ -716,11 +700,11 @@
my $column_name = shift;
my $col = $self->column($column_name);
- my $definition = $self->_make_schema()->column_definition_sql($self->table => $col->name);
+ my $definition = $self->_make_schema()
+ ->column_definition_sql( $self->table => $col->name );
return "ALTER TABLE " . $self->table . " ADD COLUMN " . $definition;
}
-
=head2 add_column_in_db column_name
Executes the SQL code generated by add_column_sql. Dies on failure.
@@ -729,14 +713,19 @@
sub add_column_in_db {
my $self = shift;
- my $ret = Jifty->handle->simple_query($self->add_column_sql(@_));
- $ret or die "error adding column ". $_[0] ." to $self: " . $ret->error_message;
+ my $ret = Jifty->handle->simple_query( $self->add_column_sql(@_) );
+ $ret
+ or die "error adding column "
+ . $_[0]
+ . " to $self: "
+ . $ret->error_message;
}
=head2 drop_column_sql column_name
-Returns the SQL statement necessary to remove C<column_name> from this class's representation in the database
+Returns the SQL statement necessary to remove C<column_name> from this
+class's representation in the database
=cut
@@ -748,7 +737,6 @@
return "ALTER TABLE " . $self->table . " DROP COLUMN " . $col->name;
}
-
=head2 drop_column_in_db column_name
Executes the SQL code generated by drop_column_sql. Dies on failure.
@@ -757,14 +745,20 @@
sub drop_column_in_db {
my $self = shift;
- my $ret = Jifty->handle->simple_query($self->drop_column_sql(@_));
- $ret or die "error dropping column ". $_[0] ." to $self: " . $ret->error_message;
+ my $ret = Jifty->handle->simple_query( $self->drop_column_sql(@_) );
+ $ret
+ or die "error dropping column "
+ . $_[0]
+ . " to $self: "
+ . $ret->error_message;
}
=head2 schema_version
-This method is used by L<Jifty::DBI::Record> to determine which schema version is in use. It returns the current database version stored in the configuration.
+This method is used by L<Jifty::DBI::Record> to determine which schema
+version is in use. It returns the current database version stored in
+the configuration.
Jifty's notion of the schema version is currently broken into two:
@@ -772,11 +766,14 @@
=item 1.
-The Jifty version is the first. In the case of models defined by Jifty itself, these use the version found in C<$Jifty::VERSION>.
+The Jifty version is the first. In the case of models defined by Jifty
+itself, these use the version found in C<$Jifty::VERSION>.
=item 2.
-Any model defined by your application use the database version declared in the configuration. In F<etc/config.yml>, this is lcoated at:
+Any model defined by your application use the database version
+declared in the configuration. In F<etc/config.yml>, this is lcoated
+at:
framework:
Database:
@@ -784,15 +781,17 @@
=back
-A model is considered to be defined by Jifty if it the package name starts with "Jifty::". Otherwise, it is assumed to be an application model.
+A model is considered to be defined by Jifty if it the package name
+starts with "Jifty::". Otherwise, it is assumed to be an application
+model.
=cut
sub schema_version {
my $class = shift;
-
+
# Return the Jifty schema version
- if ($class =~ /^Jifty::Model::/) {
+ if ( $class =~ /^Jifty::Model::/ ) {
return $Jifty::VERSION;
}
@@ -806,4 +805,3 @@
}
1;
-
More information about the Jifty-commit
mailing list