Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 什么';这项功能在tryton中的用途是什么?_Python_Database_Python 2.7_Tryton - Fatal编程技术网

Python 什么';这项功能在tryton中的用途是什么?

Python 什么';这项功能在tryton中的用途是什么?,python,database,python-2.7,tryton,Python,Database,Python 2.7,Tryton,在阅读Tryton的代码模块时,我遇到了很多这种方法,但我没有弄清楚这是为了什么 这个函数在Tryton中有什么用途 @classmetod def __register__(cls,module_name): TableHandler = backend.get('TableHandler') cursor = Transaction().cursor table = TableHandler(cursor,cls,module_name) super(Adre

在阅读Tryton的代码模块时,我遇到了很多这种方法,但我没有弄清楚这是为了什么

这个函数在Tryton中有什么用途

@classmetod
def __register__(cls,module_name):
    TableHandler = backend.get('TableHandler')
    cursor = Transaction().cursor
    table = TableHandler(cursor,cls,module_name)
    super(Adress,cls).__register__(module_name)
    table.not_null_action('sequence', action='remove')

每次更新模型时都会调用\uuuuuuuu register\uuuu方法,该方法用于更改当前模块的数据库结构。通常情况下,tryton会为您创建所有缺少的字段(这是在ModelSQL类上完成的),但有些操作不可能自动检测到,因此您必须为其编写迁移。这是通过模型的\uuuuu寄存器\uuuuu方法完成的

复制的代码确保序列字段可为null,如果不可为null,则将列从null更改为notnull

请阅读