added _mixins to the classes to indicate which all attributes/methods/properties are being mixed in.
This commit is contained in:
parent
0a285dd6bf
commit
26e5da0e7b
@ -424,9 +424,14 @@ def chartable(chart_types):
|
||||
|
||||
cls.weekly_chart_list = weekly_chart_list
|
||||
cls.monthly_chart_list = monthly_chart_list
|
||||
|
||||
if not hasattr(cls, '_default_params'):
|
||||
cls._default_params = _default_params
|
||||
|
||||
if not hasattr(cls, '_mixins'):
|
||||
cls._mixins = []
|
||||
cls._mixins.extend(['weekly_chart_list', 'monthly_chart_list'])
|
||||
|
||||
method_names = [
|
||||
'get_weekly_%s_chart', 'recent_weekly_%s_chart', 'weekly_%s_chart_list',
|
||||
'get_monthly_%s_chart', 'recent_monthly_%s_chart', 'monthly_%s_chart_list',
|
||||
@ -437,6 +442,7 @@ def chartable(chart_types):
|
||||
for chart_type in chart_types:
|
||||
for method_name in method_names:
|
||||
setattr(cls, method_name % chart_type, locals()[method_name % chart_type])
|
||||
cls._mixins.append(method_name % chart_type)
|
||||
|
||||
return cls
|
||||
return wrapper
|
||||
|
@ -46,4 +46,8 @@ def searchable(cls):
|
||||
if not hasattr(cls, '_search_yield_func'):
|
||||
cls._search_yield_func = _search_yield_func
|
||||
|
||||
if not hasattr(cls, '_mixins'):
|
||||
cls._mixins = []
|
||||
cls._mixins.append('search')
|
||||
|
||||
return cls
|
||||
|
@ -31,4 +31,8 @@ def sharable(cls):
|
||||
if not hasattr(cls, '_default_params'):
|
||||
cls._default_params = _default_params
|
||||
|
||||
if not hasattr(cls, '_mixins'):
|
||||
cls._mixins = []
|
||||
cls._mixins.append('share')
|
||||
|
||||
return cls
|
@ -41,6 +41,10 @@ def shoutable(cls):
|
||||
if not hasattr(cls, '_default_params'):
|
||||
cls._default_params = _default_params
|
||||
|
||||
if not hasattr(cls, '_mixins'):
|
||||
cls._mixins = []
|
||||
cls._mixins.extend(['shouts', 'recent_shout'])
|
||||
|
||||
return cls
|
||||
|
||||
from datetime import datetime
|
||||
|
@ -74,4 +74,8 @@ def taggable(cls):
|
||||
if not hasattr(cls, '_default_params'):
|
||||
cls._default_params = _default_params
|
||||
|
||||
if not hasattr(cls, '_mixins'):
|
||||
cls._mixins = []
|
||||
cls._mixins.extend(['tags', 'add_tags', 'remove_tag'])
|
||||
|
||||
return cls
|
Loading…
Reference in New Issue
Block a user