[Jifty-commit] r4769 - in jifty/trunk: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Dec 24 20:06:11 EST 2007
Author: trs
Date: Mon Dec 24 20:06:03 2007
New Revision: 4769
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/Quota/Model/Quota.pm
Log:
r29351 at zot: tom | 2007-12-24 20:02:32 -0500
Enforce uniqueness on (object_id, object_class, type)
Modified: jifty/trunk/lib/Jifty/Plugin/Quota/Model/Quota.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Quota/Model/Quota.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Quota/Model/Quota.pm Mon Dec 24 20:06:03 2007
@@ -56,6 +56,15 @@
$args{usage} = 0
if not defined $args{usage};
+ # XXX TODO: This should be in the schema, but we can't do that at the moment
+ my $check = Jifty::Plugin::Quota::Model::Quota->new;
+ $check->load_by_cols(
+ object_id => $args{object_id},
+ object_class => $args{object_class},
+ type => $args{type}
+ );
+ return ( undef, "Already a quota for that object." ) if $check->id;
+
return $self->SUPER::create( %args );
}
More information about the Jifty-commit
mailing list