Adapted Transaction and TableHandler use

This commit is contained in:
Guillem Barba 2016-04-12 10:59:42 +02:00
parent f18d28b036
commit 539cdb0fd5
1 changed files with 4 additions and 4 deletions

View File

@ -69,17 +69,17 @@ class Activity(ModelSQL, ModelView):
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
cursor = Transaction().cursor
cursor = Transaction().connection.cursor()
sql_table = cls.__table__()
table = TableHandler(cursor, cls, module_name)
code_exists = True
if TableHandler.table_exist(cursor, cls._table):
table = TableHandler(cursor, cls, module_name)
if TableHandler.table_exist(cls._table):
table = TableHandler(cls, module_name)
code_exists = table.column_exist('code')
super(Activity, cls).__register__(module_name)
table = TableHandler(cls, module_name)
# Migration from 3.2: Remove type and direction fields
table.not_null_action('type', action='remove')
table.not_null_action('direction', action='remove')