Feb-14-2019, 06:19 AM
(This post was last modified: Feb-14-2019, 06:20 AM by AlekseyPython.)
I write this code:
Creater.py:
What can i do?
Creater.py:
from Database.Tables import Career
class Creater:
REGISTRY = []
@classmethod
def register(cls):
def decorator(child_class):
cls.REGISTRY.append(child_class)
return child_class
return decorator
.....
.....
def _create_table(self, table):
return self.connection.execute(code=table.creating())
def create_tables(self):
for table in self.REGISTRY:
self._create_table(table)Career.py:from Database import Creater
from Database.Tables import _TextsQuery
@Creater.Creater.register
class CareerTexts(_TextsQuery.AbstractText):
TABLE_NAME = 'Career'
@classmethod
def creating(cls) -> str:
return '\
CREATE TABLE ' + cls.TABLE_NAME + ' (\
id int,\
country_id smallint,\
city_id smallint,\
from_year smallint,\
until_year smallint,\
position varchar(50),\
PRIMARY KEY(id))'Output:@Creater.Creater.register
AttributeError: module 'Database.Creater' has no attribute 'Creater'First, the Creator module is loaded, and as far as I understand it, the Creator module doesn’t full downloading and starts loading the Career module. Since the Creator module did not load, we get an error when loading the Career module.What can i do?
