Skip to content

Commit

Permalink
Fixes #141, fixes #143: remove restriction on adding new methods to e…
Browse files Browse the repository at this point in the history
…ntities
  • Loading branch information
kozlovsky committed Sep 22, 2015
1 parent c0ecf24 commit 98fe051
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pony/orm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ def create_default_attr(entity):
entity._attrs_.append(attr)
entity._new_attrs_.append(attr)
entity._adict_['classtype'] = attr
type.__setattr__(entity, 'classtype', attr)
entity.classtype = attr
attr.process_entity_inheritance(entity)
def process_entity_inheritance(attr, entity):
if '_discriminator_' not in entity.__dict__:
Expand Down Expand Up @@ -3127,10 +3127,6 @@ def next(self):
lambda_re = re.compile(r'lambda\b')

class EntityMeta(type):
def __setattr__(entity, name, val):
if name.startswith('_') and name.endswith('_'):
type.__setattr__(entity, name, val)
else: throw(NotImplementedError)
def __new__(meta, name, bases, cls_dict):
if 'Entity' in globals():
if '__slots__' in cls_dict: throw(TypeError, 'Entity classes cannot contain __slots__ variable')
Expand Down Expand Up @@ -3235,7 +3231,7 @@ def __init__(entity, name, bases, cls_dict):
attr = PrimaryKey(int, auto=True)
attr.is_implicit = True
attr._init_(entity, 'id')
type.__setattr__(entity, 'id', attr) # entity.id = attr
entity.id = attr
new_attrs.insert(0, attr)
pk_attrs = (attr,)
index = Index(attr, is_pk=True)
Expand Down

0 comments on commit 98fe051

Please sign in to comment.