def __new__(cls, name, bases, attrs):
     # 単一DB
     attrs['_{0}__Initializers'.format(name)] = OrderedDict() # Database.__Initializers 実装
     for initer in [Apis(), Accounts(), Languages(), GnuLicenses(), Licenses(), OtherRepositories()]:
         attrs['_{0}__Initializers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
         #attrs[initer.DbId] = property(lambda cls: initer.Db)
     return type.__new__(cls, name, bases, attrs)
Esempio n. 2
0
 def __new__(cls, name, bases, attrs):
     #attrs['Initializers'] = {} # 3.6以降でないと順序保持されない。DB依存関係があるので順序必要
     from collections import OrderedDict
     attrs['Initializers'] = OrderedDict()
     for initer in [Apis(), Accounts(), Languages(), GnuLicenses(), Licenses(), OtherRepositories(), Repositories()]
         attrs['Initializers'][initer.DbId] = initer
         #attrs[initer.DbId] = property(lambda : initer)
         attrs[initer.DbId] = property(lambda : initer.Db)
     return type.__new__(cls, name, bases, attrs)
     """
 def __new__(cls, name, bases, attrs):
     #attrs['Initializers'] = {} # 3.6以降でないと順序保持されない。DB依存関係があるので順序必要
     from collections import OrderedDict
     attrs['_{0}__Initializers'.format(name)] = OrderedDict() # Database.__Initializers 実装
     for initer in [Apis(), Accounts(), Languages(), GnuLicenses(), Licenses(), OtherRepositories(), Repositories()]:
         attrs['_{0}__Initializers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
         #attrs['_{0}__Initializers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
         #attrs[initer.DbId] = property(lambda : initer) # Database.Accounts = property(lambda : database.init.AccountsDbInitializer.AccountsDbInitializer())
     return type.__new__(cls, name, bases, attrs)
     """
Esempio n. 4
0
    def __new__(cls, name, bases, attrs):

        # 単一DB
        attrs['_{0}__Initializers'.format(name)] = OrderedDict() # Database.__Initializers 実装
        for initer in [Apis(), Accounts(), Languages(), GnuLicenses(), Licenses(), OtherRepositories()]:
            print(type(initer), initer)
            attrs['_{0}__Initializers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
            #attrs[initer.DbId] = property(lambda cls: initer.Db)

        """
        # ユーザ単位DB(AccountsDB生成後でないと作れない)
        attrs['_{0}__InitializersByMultiUsers'.format(name)] = OrderedDict()
        accountsDb = attrs['_{0}__Initializers'.format(name)]['Accounts'].Db
        for initer in [cls(accountsDb) for cls in [Repositories]]:
            attrs['_{0}__InitializersByMultiUsers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
            #attrs[initer.DbId] = property(lambda cls: initer.Db)
        """

        return type.__new__(cls, name, bases, attrs)
Esempio n. 5
0
 def __new__(cls, name, bases, attrs):
     from collections import OrderedDict
     attrs['_{0}__Initializers'.format(name)] = OrderedDict() # Database.__Initializers 実装
     for initer in [Apis(), Accounts(), Languages(), GnuLicenses(), Licenses(), OtherRepositories(), Repositories(), Contributions()]:
         attrs['_{0}__Initializers'.format(name)][initer.DbId] = initer # Database.__Initializers['Accounts'] = database.init.AccountsDbInitializer.AccountsDbInitializer()
     return type.__new__(cls, name, bases, attrs)