[Jifty-commit] jifty-dbi branch, computed-columns, updated. 0.60-14-gb6728ef

Jifty commits jifty-commit at lists.jifty.org
Wed May 19 04:06:57 EDT 2010

The branch, computed-columns has been updated
       via  b6728eff0570fa5b38f6d4ad24fe9a26e5482bc9 (commit)
      from  a41aa36a2f316750d8e0c8c60a4c25daf9ed911f (commit)

Summary of changes:
 lib/Jifty/DBI/Record.pm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit b6728eff0570fa5b38f6d4ad24fe9a26e5482bc9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed May 19 17:05:26 2010 +0900

    For computed columns, __value just calls the method
        This may look like it will cause infinite recursion, but the method
        that computes the column's value is defined by the application
        author, and will not call _value or __value on its own. We need this
        so that (among other things) Jifty's REST API, which uses
        ->_value($name), not ->$name, works well with computed columns

diff --git a/lib/Jifty/DBI/Record.pm b/lib/Jifty/DBI/Record.pm
index 4ab68cd..236cc2c 100755
--- a/lib/Jifty/DBI/Record.pm
+++ b/lib/Jifty/DBI/Record.pm
@@ -847,6 +847,10 @@ sub __value {
     my $column_name = $column->{name}; # Speed optimization
+    if ($column->computed) {
+        return $self->$column_name;
+    }
     # In the default case of "yeah, we have a value", return it as
     # fast as we can.
     return $self->{'values'}{$column_name}


More information about the Jifty-commit mailing list