[Jifty-commit] r958 - in jifty/trunk: .

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Apr 28 16:28:39 EDT 2006


Author: alexmv
Date: Fri Apr 28 16:28:38 2006
New Revision: 958

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Model/Metadata.pm

Log:
 r12688 at zoq-fot-pik:  chmrr | 2006-04-28 16:28:22 -0400
  * Class 'load' and 'store' methods always act as the superuser


Modified: jifty/trunk/lib/Jifty/Model/Metadata.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Model/Metadata.pm	(original)
+++ jifty/trunk/lib/Jifty/Model/Metadata.pm	Fri Apr 28 16:28:38 2006
@@ -22,10 +22,9 @@
 package Jifty::Model::Metadata::Schema;
 use Jifty::DBI::Schema;
 
-column key => type is 'text';
+column key   => type is 'text';
 column value => type is 'text';
 
-
 package Jifty::Model::Metadata;
 use version;
 
@@ -37,7 +36,7 @@
 
 =cut
 
-sub table { '_jifty_metadata' }
+sub table {'_jifty_metadata'}
 
 =head2 since
 
@@ -45,7 +44,7 @@
 
 =cut
 
-sub since { '0.60427' }
+sub since {'0.60427'}
 
 =head2 load KEY
 
@@ -56,15 +55,17 @@
 
 sub load {
     my $self = shift;
-    $self = $self->new() unless ref $self;
+    $self = $self->new( current_user => Jifty::CurrentUser->superuser )
+        unless ref $self;
     return undef unless $self->_handle and $self->_handle->dbh->ping;
 
     my ($key) = @_;
+
     # This may barf all over the place.  That's almost expected in
     # some circumstances, so we eat all warnings and errors right
     # here, right now.
     eval {
-        local $SIG{__WARN__} = sub {};
+        local $SIG{__WARN__} = sub { };
         $self->load_by_cols( key => $key );
     };
     return undef unless $self->id;
@@ -80,14 +81,15 @@
 
 sub store {
     my $self = shift;
-    $self = $self->new() unless ref $self;
+    $self = $self->new( current_user => Jifty::CurrentUser->superuser )
+        unless ref $self;
 
-    my ($key, $value) = @_;
+    my ( $key, $value ) = @_;
     $self->load_by_cols( key => $key );
-    if ($self->id) {
+    if ( $self->id ) {
         $self->set_value($value);
     } else {
-        $self->create( key => $key, value => $value);
+        $self->create( key => $key, value => $value );
     }
 }
 


More information about the Jifty-commit mailing list