[Jifty-commit] jifty branch, jifty_client, updated. 0803368a20c3b357704c0bfe43222c4598f66a00
Jifty commits
jifty-commit at lists.jifty.org
Mon May 3 04:29:37 EDT 2010
The branch, jifty_client has been updated
via 0803368a20c3b357704c0bfe43222c4598f66a00 (commit)
from 32c2215afe15969886891863b5ead1251b400a7d (commit)
Summary of changes:
lib/Jifty/Plugin/REST/Dispatcher.pm | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 0803368a20c3b357704c0bfe43222c4598f66a00
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon May 3 16:28:59 2010 +0800
Add some type constraints to Joose columns
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index 4af1c41..5c42175 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -976,6 +976,16 @@ sub show_joose_class {
}
}
+ if ($col->name eq 'id') {
+ $props->{isa} = 'Joose.Type.Int';
+ }
+ elsif ($col->is_string) {
+ $props->{isa} = 'Joose.Type.Str';
+ }
+ elsif ($col->is_numeric) {
+ $props->{isa} = 'Joose.Type.Num';
+ }
+
$cols->{$col->name} = $props;
}
@@ -992,7 +1002,8 @@ sub show_joose_class {
# to confuse it with an object that defines a TO_JSON method returning
# a bareword does not work. and Joose does not let you say isa: 'Super'.
# better ideas welcome...
- $class_definition =~ s/"isa":"JiftyModel"/"isa":JiftyModel/;
+ $class_definition =~ s/"isa":"JiftyModel"/"isa":JiftyModel/g;
+ $class_definition =~ s/"isa":"Joose\.Type\.(\w+)"/"isa":Joose.Type.$1/g;
return $class_definition;
}
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list