如何基于抽象类和flask_restful在类中设置构造函数

问题描述

嗨,我在烧瓶和创建rest应用程序时遇到了一些问题。 问题是我不知道如何以正确的方式传递数据。

class Chessman(object):
    __Metaclass__ = ABCMeta

    def __init__(self,currentField):
        self.currentField = currentField
        x,y = self.currentField
        self.x,self.y = ord(x)-97,8-int(y)
        super().__init__()

    @abstractmethod
    def list_available_moves(self):pass

    def validate_move(self,dest_field):
        return dest_field in self.list_available_moves()


class King(Chessman,Resource):
    def list_available_moves(self):
        return None

api.add_resource(King,'/api/<string:figure>/<string:currentField>')

不知道如何正确设置它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)