コード例 #1
0
ファイル: admin.py プロジェクト: ListFranz/PyCMS-Tornado
    def new(cls, role_name, description, list_order, status):
        """
        add new role
        """
        role = AdminRole(None, role_name, description, list_order, status)

        db_session.add(role)
        try:
            db_session.commit()
            return True
        except:
            db_session.rollback()
            return None
コード例 #2
0
    def new(cls, role_name, description, list_order, status):
        """
        add new role
        """
        role = AdminRole(None, role_name, description, list_order, status)

        db_session.add(role)
        try:
            db_session.commit()
            return True
        except:
            db_session.rollback()
            return None
コード例 #3
0
    def new(cls, category_name):
        """
        add new news
        """
        newsCategory = NewsCategory(None, category_name)

        db_session.add(newsCategory)
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if newsCategory.category_id:
            return cls.get(newsCategory.category_id)
        return None
コード例 #4
0
ファイル: news.py プロジェクト: ListFranz/PyCMS-Tornado
    def new(cls, category_name):
        """
        add new news
        """
        newsCategory = NewsCategory(None, category_name)

        db_session.add(newsCategory)
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if newsCategory.category_id:
            return cls.get(newsCategory.category_id)
        return None
コード例 #5
0
    def new(cls, username, email, password, reg_ip):
        """
        add new user
        """
        user = User(None, username, email)
        user.password = encrypt(password) if password else ''
        user.reg_ip = reg_ip
        db_session.add(user)
        #只有提交事务了,才可以获取(user.user_id)数据的ID值
        try:
            db_session.commit()
        except:
            db_session.rollback()
        db_session.close()

        if user.user_id:
            return cls.get(user.user_id)
        return None
コード例 #6
0
ファイル: user.py プロジェクト: ListFranz/PyCMS-Tornado
    def new(cls, username, email, password, reg_ip):
        """
        add new user
        """
        user = User(None, username, email)
        user.password = encrypt(password) if password else ''
        user.reg_ip = reg_ip
        db_session.add(user)
        #只有提交事务了,才可以获取(user.user_id)数据的ID值
        try:
            db_session.commit()
        except:
            db_session.rollback()
        db_session.close()

        if user.user_id:
            return cls.get(user.user_id)
        return None
コード例 #7
0
    def new(cls, category_id, title, content, create_uid, status):
        """
        add new news
        """
        news = News(None, category_id, title, content, create_uid, status)

        #TODO optimize
        news.update_time = '0000-00-00 00:00:00'

        db_session.add(news)
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if news.news_id:
            return cls.get(news.news_id)
        return None
コード例 #8
0
ファイル: news.py プロジェクト: ListFranz/PyCMS-Tornado
    def new(cls, category_id, title, content, create_uid, status):
        """
        add new news
        """
        news = News(None, category_id, title, content, create_uid, status)

        #TODO optimize
        news.update_time = '0000-00-00 00:00:00'

        db_session.add(news)
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if news.news_id:
            return cls.get(news.news_id)
        return None
コード例 #9
0
ファイル: admin.py プロジェクト: ListFranz/PyCMS-Tornado
    def new(cls, username, email, password, realname, role_id):
        """
        add new user
        """
        user = Admin(None, username, email, realname, role_id)
        user.password = encrypt(password) if password else ''
        user.status = 1
        #TODO optimize
        user.last_login_time = '0000-00-00 00:00:00'
        user.last_login_ip = ''
        user.login_times = 0
        user.update_time = '0000-00-00 00:00:00'

        db_session.add(user)
        #只有提交事务了,才可以获取(user.user_id)数据的ID值
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if user.user_id:
            return cls.get(user.user_id)
        return None
コード例 #10
0
    def new(cls, username, email, password, realname, role_id):
        """
        add new user
        """
        user = Admin(None, username, email, realname, role_id)
        user.password = encrypt(password) if password else ''
        user.status = 1
        #TODO optimize
        user.last_login_time = '0000-00-00 00:00:00'
        user.last_login_ip = ''
        user.login_times = 0
        user.update_time = '0000-00-00 00:00:00'

        db_session.add(user)
        #只有提交事务了,才可以获取(user.user_id)数据的ID值
        try:
            db_session.commit()
        except:
            db_session.rollback()

        if user.user_id:
            return cls.get(user.user_id)
        return None