我正面临以下困境......
MethodNotAllowedHttpExException
如何在抽象接口class XCEngine:
def __init__(self, year, xrules=None):
self.year = year
if xrules is None:
xrules=[]
self.xrules = xrules #<------- set rules[] with this
class Xchange(AbstractHolidayCalendar): # abstract interface reference
rules = [] #<------- need to dynamically set the rules[]
# Below is how I'm using the above snippet:
def compute(self):
date_index = XCEngine.Xchange().holidays(dt.datetime(self.year - 1, 12, 31), dt.datetime(self.year, 12, 31))
date_index3 = date_index.to_native_types().tolist()
return date_index3
中设置rules[]
列表?
我正在尝试将Xchange
替换为rules[]
[增订]
[向self.xrules
]
XCEngine
[然后,创建对象并调用:]
def ruleswriter(self):
XCEngine.Xchange().rules = self.xrules
[引发以下错误]:
def something():
some = [USMartinLutherKingJr]
XCEngine.ruleswriter(some)
print XCEngine(2017).compute()
something()