Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to implement class register?
I write this code:
from Database.Tables import Career

class Creater:
    REGISTRY = []
    def register(cls):
        def decorator(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:
from Database import Creater
from Database.Tables import _TextsQuery

class CareerTexts(_TextsQuery.AbstractText):
    TABLE_NAME = 'Career'
    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))'
@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?

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  how to implement the .mymethod() notation of Python Pedroski55 4 141 Apr-22-2019, 10:24 PM
Last Post: Gribouillis
  Trying to implement Python into embedded OS thesurya7 2 76 Apr-02-2019, 06:38 PM
Last Post: ebolisa
  Get variable from class inside another class hcne 3 97 Mar-30-2019, 03:02 PM
Last Post: ichabod801
  Why Can't I call base class function for my derived class object? AmirAB 2 142 Feb-13-2019, 03:04 PM
Last Post: snippsat
  Calling a class inside other class dan789 9 350 Jan-06-2019, 02:00 PM
Last Post: dan789
  simple register code aocii 2 212 Dec-22-2018, 11:15 AM
Last Post: aocii
  Class object instance. Link instance attribute to class. Can it be done easier. Windspar 7 344 Dec-03-2018, 11:16 PM
Last Post: Windspar
  Python script runs on startup but does not register keystrokes. mericanpi 3 483 Sep-07-2018, 02:58 PM
Last Post: mericanpi
  Correct way to implement immutable class QueenSveta 3 1,120 Jun-20-2018, 07:34 PM
Last Post: snippsat
  How to check if class instance exists in a list of class instance objects? sonicblind 23 2,301 May-27-2018, 05:44 AM
Last Post: buran

Forum Jump:

Users browsing this thread: 1 Guest(s)