[Bps-public-commit] Prophet - A disconnected, replicated p2p database branch, master, updated. 9bec95a1256d5fd327a6c571a824a4fe317cd632
spang at bestpractical.com
spang at bestpractical.com
Mon Jan 19 16:11:06 EST 2009
The branch, master has been updated
via 9bec95a1256d5fd327a6c571a824a4fe317cd632 (commit)
via 8e090b34d1430b6d1d2e0c1129153fd7db3424a6 (commit)
via f2d40cea77b968555b32223a29acc076a8c831c7 (commit)
from e13778c42cafe1b59664bed9c0c617e3e1c1bcc5 (commit)
Summary of changes:
lib/Prophet/CLI/TextEditorCommand.pm | 5 +++--
lib/Prophet/Record.pm | 9 ++++++---
2 files changed, 9 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit f2d40cea77b968555b32223a29acc076a8c831c7
Author: Christine Spang <spang at mit.edu>
Date: Mon Jan 19 20:43:46 2009 +0200
allow props to override validation if they end in !
diff --git a/lib/Prophet/Record.pm b/lib/Prophet/Record.pm
index 734f582..ed3b5c4 100644
--- a/lib/Prophet/Record.pm
+++ b/lib/Prophet/Record.pm
@@ -590,7 +590,9 @@ sub validate_prop_from_recommended_values {
my $args = shift;
if ( my @options = $self->recommended_values_for_prop($prop) ) {
- return 1 if scalar grep { $args->{props}{$prop} eq $_ } @options;
+ return 1 if ((scalar grep { $args->{props}{$prop} eq $_ } @options)
+ # force-set props with ! to bypass validation
+ || $args->{props}{$prop} =~ s/!$//);
$args->{errors}{$prop}
= "'" . $args->{props}->{$prop} . "' is not a valid $prop";
commit 8e090b34d1430b6d1d2e0c1129153fd7db3424a6
Author: Christine Spang <spang at bestpractical.com>
Date: Mon Jan 19 21:03:00 2009 +0200
one of these days I'll get the newlines right
diff --git a/lib/Prophet/CLI/TextEditorCommand.pm b/lib/Prophet/CLI/TextEditorCommand.pm
index 20d72c2..564a18c 100644
--- a/lib/Prophet/CLI/TextEditorCommand.pm
+++ b/lib/Prophet/CLI/TextEditorCommand.pm
@@ -101,7 +101,7 @@ sub handle_template_errors {
${ $args{'template_ref'} }
= "=== errors in this $args{rtype} ====\n\n"
- . $args{error} . "\n"
+ . $args{error} . "\n\n"
. $args{bad_template};
return 0;
}
commit 9bec95a1256d5fd327a6c571a824a4fe317cd632
Author: Christine Spang <spang at bestpractical.com>
Date: Mon Jan 19 21:32:08 2009 +0200
mention how to bypass errors after printing them in the template
diff --git a/lib/Prophet/CLI/TextEditorCommand.pm b/lib/Prophet/CLI/TextEditorCommand.pm
index 564a18c..c083c00 100644
--- a/lib/Prophet/CLI/TextEditorCommand.pm
+++ b/lib/Prophet/CLI/TextEditorCommand.pm
@@ -102,7 +102,8 @@ sub handle_template_errors {
${ $args{'template_ref'} }
= "=== errors in this $args{rtype} ====\n\n"
. $args{error} . "\n\n"
- . $args{bad_template};
+ . 'You can bypass validation for a property by appending a ! to it.'
+ . "\n\n" . $args{bad_template};
return 0;
}
diff --git a/lib/Prophet/Record.pm b/lib/Prophet/Record.pm
index ed3b5c4..bf500ea 100644
--- a/lib/Prophet/Record.pm
+++ b/lib/Prophet/Record.pm
@@ -477,8 +477,9 @@ sub validate_props {
for my $key ( uniq( keys %$props, $self->declared_props ) ) {
return undef unless ( $self->_validate_prop_name($key) );
if ( my $sub = $self->can( 'validate_prop_' . $key ) ) {
- $sub->( $self, props => $props, errors => $errors ) || push @errors,
- "Validation error for '$key': " . ( $errors->{$key} || '' );
+ $sub->( $self, props => $props, errors => $errors ) ||
+ push @errors,"Validation error for '$key': " .
+ ( $errors->{$key} || '' ) . '.';
}
}
if (@errors) {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list