Ignore:
Timestamp:
Sep 21, 2006 7:49:02 AM (12 years ago)
Author:
hazmat
Message:

add field overriding, using first one wins rules

Location:
Products.ContentFlavors/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Products.ContentFlavors/trunk/readme.txt

    r1675 r1679  
    217217---- 
    218218 
    219  - Composed Schema work, fields don't currently override properly, they are all 
    220    returned. 
     219 - rewrite unit tests to be independent of external projects 
    221220 
    222221 
  • Products.ContentFlavors/trunk/schema.py

    r1677 r1679  
    7171        # flavor schema need to point to differing methods from 
    7272        # instance to instance. Sad, but not a major problem. 
    73         for flavor in reversed( provider.flavors ): 
     73        for flavor in provider.flavors: 
    7474            flavor_schema = flavor.archetype_schema.copy() 
    7575            schemas.append( flavor_schema ) 
     
    9292        self._schemas = [] 
    9393 
     94    def fields(self): 
     95        """overide composite fields method to provide for overriding 
     96        and ordering semantics. 
     97        """ 
     98        field_order = [] 
     99        field_map = {} 
     100        for schema in self.getSchemas(): 
     101            for field in schema.fields(): 
     102                if field.getName() not in field_order: 
     103                    field_order.append( field.getName() ) 
     104                    field_map[ field.getName() ] = field 
     105        return [ field_map[fn] for fn in field_order ] 
     106             
     107             
    94108################################# 
    95109# Cache -- XXX not wired in.. uses instance caches and modification events 
Note: See TracChangeset for help on using the changeset viewer.