Changeset 949 for LATMOS-Accounts


Ignore:
Timestamp:
04/27/12 11:34:19 (12 years ago)
Author:
nanardon
Message:
  • allow to use Attributes object w/o description from base
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Attributes.pm

    r936 r949  
    2525        : (undef, $base_or_object, $maybe_otype); 
    2626 
    27     my $attr_info = $base->get_attr_schema($otype, $attributes) or return; 
    28  
    29     $attr_info->{_base} = $base; 
    30     $attr_info->{_object} = $object; 
    31     $attr_info->{_name} = $attributes; 
    32     $attr_info->{_otype} = $otype; 
    33  
    34     bless($attr_info, $class); 
     27    if (ref $attributes) { 
     28        $attributes->{_base} = $base; 
     29        $attributes->{_object} = $object; 
     30        $attributes->{_name} = $attributes->{name}; 
     31        $attributes->{_otype} = $otype; 
     32        return bless($attributes, $class); 
     33    } else { 
     34        my $attr_info = $base->get_attr_schema($otype, $attributes) or return; 
     35 
     36        $attr_info->{_base} = $base; 
     37        $attr_info->{_object} = $object; 
     38        $attr_info->{_name} = $attributes; 
     39        $attr_info->{_otype} = $otype; 
     40 
     41        return bless($attr_info, $class); 
     42    } 
    3543} 
    3644 
Note: See TracChangeset for help on using the changeset viewer.