[Rt-devel] Re: RT::Attribute::Name Unimplemented in RT::Attributes error

Joby Walker joby at u.washington.edu
Wed Dec 21 20:46:21 EST 2005


Thanks,

Hadn't seen that yet.  This is pretty easy to override though by having
RT::Record->Attributes always return a fresh RT::Attributes object.  You
lose the caching of all attributes in the parent object, but I don't see
that as a disadvantage.  All the attributes that get regularly called we
actively save in the user's session, and loading all of a user's (either
directly or via a group) SavedSearches, Reports, and Schedules any time
I want one of the user's attributes is not going to be efficient.

Joby Walker
ITI SSG, C&C, University of Washington


Stephen Turner wrote:
> 
> At Wednesday 12/21/2005 06:49 PM, Joby Walker wrote:
> 
>> We are using attributes for a bunch of saved resources (Searches,
>> Reports (Statistics like graphs), scheduled reports, etc) and our custom
>> stuff will occasionally exhibit the Attributes error -- even with the
>> DBIx::SearchBuilder "fix" (removing the line).
>>
>> Today I extended RT::Attributes to remove the caching and made it
>> similar to the other collection classes.  I have yet to see a failure --
>> but there is a lot more testing to do.
> 
> 
> Hi Joby,
> 
> I think this causes other problems - I tried it myself earlier and
> although I didn't see the error, the data I got back wasn't what I wanted.
> 
> When you do Object->Attributes->Named('ddd') then the Attributes object
> is cached in the Object (see Record.pm). By limiting the Attributes
> object to just the ones that match the name (below), the cached object's
> attributes are now limited and subsequent calls to Object->Attributes
> will get you just those with the name you used before, not all the
> attributes.
> 
> Steve
> 
> 
>> Attributes_Local.pm
>> ----------------------------------------------------------------
>> package RT::Attributes;
>>
>> use strict;
>> no warnings qw(redefine);
>>
>> sub _DoSearch {
>>     my $self = shift;
>>     $self->SUPER::_DoSearch();
>> }
>>
>> sub Named {
>>     my $self = shift;
>>     my $name = shift;
>>     $self->Limit(FIELD => 'Name',
>>                  OPERATOR => '=',
>>                  VALUE => $name);
>>     $self->_DoSearch();
>>
>>     my @attributes;
>>     while (my $attr = $self->Next) {
>>         push (@attributes, $attr);
>>     }
>>     return @attributes;
>> }
>> return 1;
>> ----------------------------------------------------------------
> 
> 


More information about the Rt-devel mailing list