Пример #1
0
 def add(self, kwargs):
     """parameters db fashej table"""
     recorder = Fashej()
     for kw in kwargs.keys():
         setattr(recorder, kw, kwargs[kw])
     kb_session.add(recorder)
     try:
         kb_session.commit()
     except:
         kb_session.rollback()
         pass
Пример #2
0
    def add(self, argsdic):
        """parameters db branch table"""
        branch = Branch()
        for kw in argsdic.keys():
            setattrib(branch, kw, argsdic[kw])

        kb_session.add(branch)
        try:
            kb_session.commit()
        except:
            kb_session.rollback()
            pass
Пример #3
0
    def Addmodel(self,modelId,xhdm,xhmc):
        """parameters db model table"""
        model = Model()
        model.id = modelId
        model.xhdm = xhdm
        model.xhmc = xhmc

        kb_session.add(model)
        try:
            kb_session.commit()
        except:
            kb_session.rollback()
            raise
Пример #4
0
    def addModel(self, **kwargs):
        """parameters db model table"""
        model = Model()
        #         model.modelId = kwargs['modelId']
        model.xhdm = kwargs['xhdm']
        model.xhmc = kwargs['xhmc']
        # # registry db sources

        #
        #         saconnect = ISQLAlchemyConnectionStrings(getSite())
        # # Register z3c.saconfig utilities for mysql parameters db
        #         dbURI = saconnect['mysql']
        # # Register z3c.saconfig utilities for pas.plugins.sqlarchemy
        #         engine = EngineFactory(dbURI, echo=False, convert_unicode=False)
        #         provideUtility(engine, name=u"mysql.parameters")
        #         session = GloballyScopedSession(engine=u"mysql.parameters", twophase=False)
        #         provideUtility(session,name=u"mysql.parameters")
        kb_session.add(model)
        try:
            kb_session.commit()
        except:
            kb_session.rollback()
            pass