Changeset 53

Show
Ignore:
Timestamp:
02/12/07 17:39:42 (6 years ago)
Author:
ged
Message:

further reorder things... hopefully fixing the autoload problem

Location:
elixir/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/__init__.py

    r52 r53  
    7575    before defining your entities. 
    7676    ''' 
    77     global delay_setup 
    78     delay_setup = False 
    7977    for entity in delayed_entities: 
    8078        entity.setup_table() 
     
    8280        entity.setup_mapper() 
    8381    delayed_entities.clear() 
     82    # try to setup all uninitialized relationships 
     83    EntityDescriptor.setup_relationships() 
    8484    create_all() 
    8585 
  • elixir/trunk/elixir/entity.py

    r51 r53  
    8585        self.setup_table() 
    8686        self.setup_mapper() 
     87 
     88        # try to setup all uninitialized relationships 
     89        EntityDescriptor.setup_relationships() 
    8790     
    8891    def setup_mapper(self): 
    8992        ''' 
    90         Initializes and assign an (empty!) mapper to the given entity, which  
    91         needs a table defined, so it calls setup_table. 
     93        Initializes and assign an (empty!) mapper to the given entity, the. 
    9294        ''' 
    9395        if self.entity.mapper: 
     
    109111            self.relationships.values()) 
    110112 
    111         # try to setup all uninitialized relationships 
    112         EntityDescriptor.setup_relationships() 
    113113     
    114114    def translate_order_by(self, order_by): 
  • elixir/trunk/tests/test_autoload.py

    r47 r53  
    3232elixir.delay_setup = True 
    3333 
     34class Animal(Entity): 
     35#    has_field('name', String(15)) 
     36#    has_field('color', String(15)) 
     37     
     38    belongs_to('owner', of_kind='Person', colname='owner_id') 
     39    belongs_to('feeder', of_kind='Person', colname='feeder_id') 
     40 
     41    using_options(autoload=True, shortnames=True) 
     42 
    3443class Person(Entity): 
    3544#    has_field('name', Unicode(32)) 
     
    4655        return s 
    4756 
    48 class Animal(Entity): 
    49 #    has_field('name', String(15)) 
    50 #    has_field('color', String(15)) 
    51      
    52     belongs_to('owner', of_kind='Person', colname='owner_id') 
    53     belongs_to('feeder', of_kind='Person', colname='feeder_id') 
    54  
    55     using_options(autoload=True, shortnames=True) 
    5657 
    5758elixir.delay_setup = False