Changeset 510

Show
Ignore:
Timestamp:
11/09/09 12:56:31 (4 years ago)
Author:
ged
Message:

- Fixed having relationships in custom base classes (based on patch

by Stéphane Klein)

Location:
elixir/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/CHANGES

    r505 r510  
    1212- Fixed custom base classes and versioned extension when used with zope 
    1313  interfaces (closes #98, patch from Valentin Lab) 
     14- Fixed having relationships in custom base classes (based on patch 
     15  by Stéphane Klein) 
    1416 
    15170.7.0 - 2009-10-01 
  • elixir/trunk/elixir/entity.py

    r509 r510  
    88import warnings 
    99 
    10 from copy import copy 
     10from copy import deepcopy 
    1111 
    1212import sqlalchemy 
     
    718718        base_props = getmembers(entity_base, 
    719719                                lambda a: isinstance(a, Property)) 
    720         base_props = [(name, copy(attr)) for name, attr in base_props] 
     720        base_props = [(name, deepcopy(attr)) for name, attr in base_props] 
    721721    else: 
    722722        base_props = [] 
  • elixir/trunk/tests/test_custombase.py

    r505 r510  
    116116        assert 'common' in B.table.columns 
    117117 
     118    def test_base_with_relation(self): 
     119        class FieldBase(object): 
     120            __metaclass__ = EntityMeta 
     121 
     122            common = ManyToOne('A') 
     123 
     124        class A(FieldBase): 
     125            name = Field(String(32)) 
     126 
     127        class B(FieldBase): 
     128            pass 
     129 
     130        setup_all(True) 
     131 
     132        assert 'name' in A.table.columns 
     133        assert 'common_id' in A.table.columns 
     134        assert 'common_id' in B.table.columns 
     135 
    118136    def test_base_with_fields_in_parent(self): 
    119137        class BaseParent(object):