[Jifty-commit] r7074 - jifty/trunk/lib/Jifty
Jifty commits
jifty-commit at lists.jifty.org
Tue May 19 15:08:34 EDT 2009
Author: sartak
Date: Tue May 19 15:08:32 2009
New Revision: 7074
Modified:
jifty/trunk/lib/Jifty/Action.pm
Log:
Use all args for creating the widget cache key
Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm (original)
+++ jifty/trunk/lib/Jifty/Action.pm Tue May 19 15:08:32 2009
@@ -467,23 +467,19 @@
# Generalized helper for the two above
sub _form_widget {
- my $self = shift;
- my %args = ( argument => undef,
- render_mode => 'update',
- @_);
+ my $self = shift;
+ my %args = (
+ argument => undef,
+ render_mode => 'update',
+ @_,
+ );
+ my $cache_key = join '!!', %args;
# Setup the field name
my $field = $args{'argument'};
- my $arg_name = $field. '!!' .$args{'render_mode'};
-
- # They specified some arguments. This means we don't want to reuse the
- # cached version, since that will ignore the arguments.
- if (keys(%args) > 2) {
- delete $self->{_private_form_fields_hash}{$arg_name};
- }
# This particular field hasn't been added to the form yet
- if ( not exists $self->{_private_form_fields_hash}{$arg_name} ) {
+ if ( not exists $self->{_private_form_fields_hash}{$cache_key} ) {
my $field_info = $self->arguments->{$field};
# The field name is not known by this action
unless ($field_info) {
@@ -524,16 +520,11 @@
);
# Add the form field to the cache
- $self->{_private_form_fields_hash}{$arg_name}
+ $self->{_private_form_fields_hash}{$cache_key}
= Jifty::Web::Form::Field->new(%field_args);
- }
- # It has been cached, but render_as is explicitly set
- elsif ( my $widget = $args{render_as} ) {
- $self->{_private_form_fields_hash}{$arg_name}->rebless( $widget );
-
}
- return $self->{_private_form_fields_hash}{$arg_name};
+ return $self->{_private_form_fields_hash}{$cache_key};
}
=head2 hidden ARGUMENT VALUE
More information about the Jifty-commit
mailing list