[Jifty-commit] r5140 - in jifty/trunk: lib/Jifty/Plugin/OAuth lib/Jifty/Plugin/OAuth/Action lib/Jifty/Plugin/OAuth/Model

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 19 21:51:36 EST 2008


Author: sartak
Date: Tue Feb 19 21:51:35 2008
New Revision: 5140

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm
   jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
   jifty/trunk/lib/Jifty/Plugin/OAuth/Model/RequestToken.pm

Log:
 r51954 at onn:  sartak | 2008-02-19 21:50:56 -0500
 OAuth: use 0 and 1 for booleans instead of '' and 't' to satisfy all(sqlite, postgres, perl). argh.
 Render allow/deny as a selectbox in REST


Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Action/AuthorizeRequestToken.pm	Tue Feb 19 21:51:35 2008
@@ -19,6 +19,7 @@
         ajax validates;
 
     param 'authorize',
+        render as 'select',
         valid_values are qw(allow deny);
 
     param 'callback',
@@ -39,7 +40,7 @@
     my $request_token = Jifty::Plugin::OAuth::Model::RequestToken->new(current_user => Jifty::CurrentUser->superuser);
     $request_token->load_by_cols(
         token => $token,
-        authorized => '',
+        authorized => 0,
     );
 
     return $self->validation_error(token => "I don't know of that request token.") unless $request_token->id;
@@ -71,7 +72,7 @@
     $self->result->content(callback  => $self->argument_value('callback'));
 
     if ($self->argument_value('authorize') eq 'allow') {
-        $token->set_authorized('t');
+        $token->set_authorized(1);
         $self->result->message("Allowing " . $token->consumer->name . " to access your stuff.");
     }
     else {

Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	Tue Feb 19 21:51:35 2008
@@ -114,7 +114,7 @@
 
     if ($oauth_params{token}) {
         my $request_token = Jifty::Plugin::OAuth::Model::RequestToken->new(current_user => Jifty::CurrentUser->superuser);
-        $request_token->load_by_cols(token => $oauth_params{token}, authorized => '');
+        $request_token->load_by_cols(token => $oauth_params{token}, authorized => 0);
 
         if ($request_token->id) {
             set consumer => $request_token->consumer;
@@ -193,7 +193,7 @@
         if $@ || !defined($token) || !$ok;
 
     $consumer->made_request(@oauth_params{qw/timestamp nonce/});
-    $request_token->set_used('t');
+    $request_token->set_used(1);
 
     set oauth_response => {
         oauth_token        => $token->token,

Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Model/RequestToken.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Model/RequestToken.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Model/RequestToken.pm	Tue Feb 19 21:51:35 2008
@@ -22,7 +22,7 @@
 
     column authorized =>
         type is 'boolean',
-        default is '';
+        default is 0;
 
     # kludge 2: this kind of plugin cannot yet casually refer_to app models
     column authorized_by =>
@@ -33,11 +33,9 @@
         refers_to Jifty::Plugin::OAuth::Model::Consumer,
         is required;
 
-    # kludge 3: Jifty::DBI + SQLite = poor boolean handling
-    # so the empty string is the false value, 't' is the true value
     column used =>
         type is 'boolean',
-        default is '';
+        default is 0;
 
     column token =>
         type is 'varchar',


More information about the Jifty-commit mailing list