Skip to content

Commit

Permalink
Merge pull request #24 from seth-p/merge_declarative_args_declared_at…
Browse files Browse the repository at this point in the history
…tr_empty

Fix merge_declarative_args() for classmethods/callables returning empty list.
  • Loading branch information
dgilland committed Apr 26, 2015
2 parents 47ea146 + 98c5574 commit 6403fec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions alchy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,12 @@ def merge_declarative_args(cls, global_config_key, local_config_key):
kargs = {}

for obj in configs:
if not obj:
continue

obj = get_concrete_value(obj,
cls,
check_classmethod=True,
check_callable=True)
if not obj:
continue

if isinstance(obj, dict):
kargs.update(obj)
Expand Down
6 changes: 5 additions & 1 deletion tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ class MixinCM(object):
def __global_table_args__():
return (Index('idx_cm_name', 'name'),)

class ObjCM(Model, MixinCM, AbstractCM):
class MixinEmpty(object):
def __global_table_args__():
return ()

class ObjCM(Model, MixinEmpty, MixinCM, AbstractCM):
text = Column(types.Text())

@classmethod
Expand Down

0 comments on commit 6403fec

Please sign in to comment.