# Path: kokemomo/plugins/engine/model/km_storage/impl/km_rdb_adapter.py
# class BaseModel(object):
# class KMRDBAdapter(BaseAdapter):
# class Transaction(object):
#     def __tablename__(cls):
#     def __repr__(self):
#     def validate(self):
#     def save(self, validate=True):
#     def delete(self):
#     def all(cls, order=None, commit=True):
#     def get(cls, id, commit=True):
#     def delete_by_id(cls, id):
#     def delete_by_condition(cls, **kwargs):
#     def find(cls, order=None, commit=True, **kwargs):
#     def __init__(self, rdb_path, options):
#     def metadata(self):
#     def init(self, rdb_path=None, options={}):
#     def drop_all(self):
#     def add(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def commit(self):
#     def set(self, *args, **kwargs):
#     def rollback(self):
#     def get(self, *args, **kwargs):
# def rollback():
#     def begin(cls):
#     def add(cls, *args, **kwargs):
#     def delete(cls, *args, **kwargs):
#     def commit(cls):
#     def rollback(self):
# 
# Path: kokemomo/plugins/engine/model/km_validate_error.py
# class KMValidateError(object):
# 
#     def __init__(self):
#         self.list = []
# 
#     def add_data(self, id=None, message='', option=None):
#         data = {}
#         data['id'] = id
#         data['message'] = message
#         data['option'] = option
#         self.list.append(data)
# 
#     def have(self, id=None):
#         for data in self.list:
#             if data['id'] == id:
#                 return True
#         return False
# 
#     def get(self, id=None):
#         for data in self.list:
#             if data['id'] == id:
#                 return data
#         return None
# 
#     def size(self):
#         return len(self.list)


from kokemomo.plugins.engine.utils.km_model_utils import *
from kokemomo.plugins.engine.model.km_storage.impl.km_rdb_adapter import adapter
from kokemomo.plugins.engine.model.km_validate_error import KMValidateError

class KMBlogInfo(adapter.Model):
    __tablename__ = 'km_blog_info'
    id = adapter.Column(adapter.Integer, autoincrement=True, primary_key=True)
    name = adapter.Column(adapter.Text)
    url = adapter.Column(adapter.Text)
    description = adapter.Column(adapter.Text)

    def __init__(self, data=None):
        if data is None:
            self.name = ''
            self.url = ''
            self.description = ''
        else:
            self.set_data(data)

    def __repr__(self):
        return create_repr_str(self)

    def get_json(self):
        return create_json(self)


    def set_data(self, data):
        self.error = None
        self.name = data.get_request_parameter('name', default='')
        self.url = data.get_request_parameter('url', default='')
        self.description = data.get_request_parameter('description', default='')

    def validate(self):

# Path: kokemomo/plugins/engine/model/km_storage/impl/km_rdb_adapter.py
# class BaseModel(object):
# class KMRDBAdapter(BaseAdapter):
# class Transaction(object):
#     def __tablename__(cls):
#     def __repr__(self):
#     def validate(self):
#     def save(self, validate=True):
#     def delete(self):
#     def all(cls, order=None, commit=True):
#     def get(cls, id, commit=True):
#     def delete_by_id(cls, id):
#     def delete_by_condition(cls, **kwargs):
#     def find(cls, order=None, commit=True, **kwargs):
#     def __init__(self, rdb_path, options):
#     def metadata(self):
#     def init(self, rdb_path=None, options={}):
#     def drop_all(self):
#     def add(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def commit(self):
#     def set(self, *args, **kwargs):
#     def rollback(self):
#     def get(self, *args, **kwargs):
# def rollback():
#     def begin(cls):
#     def add(cls, *args, **kwargs):
#     def delete(cls, *args, **kwargs):
#     def commit(cls):
#     def rollback(self):
# 
# Path: kokemomo/plugins/engine/model/km_validate_error.py
# class KMValidateError(object):
# 
#     def __init__(self):
#         self.list = []
# 
#     def add_data(self, id=None, message='', option=None):
#         data = {}
#         data['id'] = id
#         data['message'] = message
#         data['option'] = option
#         self.list.append(data)
# 
#     def have(self, id=None):
#         for data in self.list:
#             if data['id'] == id:
#                 return True
#         return False
# 
#     def get(self, id=None):
#         for data in self.list:
#             if data['id'] == id:
#                 return data
#         return None
# 
#     def size(self):
#         return len(self.list)


# Path: kokemomo/plugins/blog/model/km_blog_info.py
from kokemomo.plugins.engine.utils.km_model_utils import *
from kokemomo.plugins.engine.model.km_storage.impl.km_rdb_adapter import adapter
from kokemomo.plugins.engine.model.km_validate_error import KMValidateError


class KMBlogInfo(adapter.Model):
    __tablename__ = 'km_blog_info'
    id = adapter.Column(adapter.Integer, autoincrement=True, primary_key=True)
    name = adapter.Column(adapter.Text)
    url = adapter.Column(adapter.Text)
    description = adapter.Column(adapter.Text)

    def __init__(self, data=None):
        if data is None:
            self.name = ''
            self.url = ''
            self.description = ''
        else:
            self.set_data(data)

    def __repr__(self):
        return create_repr_str(self)

    def get_json(self):
        return create_json(self)


    def set_data(self, data):
        self.error = None
        self.name = data.get_request_parameter('name', default='')
        self.url = data.get_request_parameter('url', default='')
        self.description = data.get_request_parameter('description', default='')

    def validate(self):

        self.error = KMValidateError()