当前位置: 首页>>代码示例>>Python>>正文


Python ListView.query方法代码示例

本文整理汇总了Python中uliweb.utils.generic.ListView.query方法的典型用法代码示例。如果您正苦于以下问题:Python ListView.query方法的具体用法?Python ListView.query怎么用?Python ListView.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uliweb.utils.generic.ListView的用法示例。


在下文中一共展示了ListView.query方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: list

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def list(self):
        from uliweb.utils.generic import ListView

        pageno = request.GET.get("page", 0)

        view = ListView(self.model, pageno=pageno, order_by=self.model.c.publish_date.desc())
        return {"blogs": view.query(), "view": view, "count": view.query().count()}
开发者ID:neoyoung,项目名称:uliwebzone,代码行数:9,代码来源:views.py

示例2: list

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
 def list(self):
     from uliweb.utils.generic import ListView
     
     pageno = request.GET.get('page', 0)
     
     view = ListView(self.model, pageno=pageno, order_by=self.model.c.publish_date.desc())
     return {'blogs':view.query(), 'view':view, 'count':view.query().count()}
开发者ID:chu888chu888,项目名称:Python-uliwebzone,代码行数:9,代码来源:views.py

示例3: list

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def list(self):
        from uliweb import request
        from uliweb.utils.generic import ListView
        from uliweb.utils.common import get_choice
        import math
        
        pageno = int(request.values.get('page', 1)) - 1
        rows_per_page=int(request.values.get('rows', settings.get_var('MESSAGES/PAGE_NUMS', 10)))

        read_flag = request.GET.get('read', '')
        type_flag = request.GET.get('type', '')
        
        condition = None
        condition = (self.model.c.user == request.user.id) & condition
        condition = (self.model.c.send_flag == 'r') & condition
        
        if read_flag:
            condition = (self.model.c.read_flag == bool(read_flag=='1')) & condition
            
        if type_flag:
            condition = (self.model.c.type == type_flag) & condition

        def create_date(value, obj):
            from uliweb.utils.timesince import timesince
            return timesince(value)
        
        def user_image(value, obj):
            return functions.get_user_image(obj.sender, size=20)
        
        def message(value, obj):
            return value
        
        fields_convert_map = {'create_date':create_date, 
            'user_image':user_image,
            'message':message}
        
        view = ListView(self.model, condition=condition, 
            order_by=[self.model.c.create_date.desc()],
            rows_per_page=rows_per_page, pageno=pageno,
            fields_convert_map=fields_convert_map)
        view.query()
        
        result = {}
        result['read_flag'] = read_flag
        result['type_flag'] = type_flag
        result['message_type_name'] = get_choice(settings.get_var('MESSAGES/MESSAGE_TYPE'), type_flag, '全部类型')
        
        pages = int(math.ceil(1.0*view.total/rows_per_page))
        
#        result['page'] = pageno+1
#        result['total'] = view.total
#        result['pages'] = pages
        result['pagination'] = functions.create_pagination(functions.request_url(), view.total, pageno+1, rows_per_page)
        result['objects'] = list(view.objects())
        ids = []
        for row in result['objects']:
            ids.append(row._obj_.id)
        self.model.filter(self.model.c.id.in_(ids)).update(read_flag=True)
        _del_key(request.user.id)
        return result
开发者ID:lypinggan,项目名称:plugs,代码行数:62,代码来源:views.py

示例4: sended_list

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def sended_list(self):
        from uliweb import request
        from uliweb.utils.generic import ListView
        from uliweb.utils.common import get_choice
        import math

        pageno = int(request.values.get("page", 1)) - 1
        rows_per_page = int(request.values.get("rows", settings.get_var("MESSAGES/PAGE_NUMS", 10)))

        read_flag = request.GET.get("read", "")
        type_flag = request.GET.get("type", "")

        condition = None
        condition = (self.model.c.sender == request.user.id) & condition
        condition = (self.model.c.send_flag == "s") & condition

        if read_flag:
            condition = (self.model.c.read_flag == bool(read_flag == "1")) & condition

        if type_flag:
            condition = (self.model.c.type == type_flag) & condition

        def create_date(value, obj):
            from uliweb.utils.timesince import timesince

            return timesince(value)

        def user_image(value, obj):
            return functions.get_user_image(obj.user, size=20)

        def message(value, obj):
            return value

        fields_convert_map = {"create_date": create_date, "user_image": user_image, "message": message}

        view = ListView(
            self.model,
            condition=condition,
            order_by=[self.model.c.create_date.desc()],
            rows_per_page=rows_per_page,
            pageno=pageno,
            fields_convert_map=fields_convert_map,
        )
        view.query()

        result = {}
        result["read_flag"] = read_flag
        result["type_flag"] = type_flag
        result["message_type_name"] = get_choice(settings.get_var("MESSAGES/MESSAGE_TYPE"), type_flag, "全部类型")

        pages = int(math.ceil(1.0 * view.total / rows_per_page))

        #        result['page'] = pageno+1
        #        result['total'] = view.total
        #        result['pages'] = pages
        result["pagination"] = functions.create_pagination(request.url, view.total, pageno + 1, rows_per_page)
        result["objects"] = view.objects()
        return result
开发者ID:woerwin,项目名称:uliwebzone,代码行数:60,代码来源:views.py

示例5: view

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
 def view(self):
     #objects = self.blogs.all()
     # model = functions.get_model('blogs').all()
     # print self.blogs
     # print model
     # return {'objects':model}
     from uliweb.utils.generic import ListView
     pageno = int(request.GET.get('page',1)) - 1
     rows_per_page = int(request.GET.get('rows', 8))
     view = ListView(self.blogs, order_by=self.blogs.c.modified_time.desc(), pageno=pageno, rows_per_page=rows_per_page)
     view.query()
     pagination = functions.create_pagination(request.url, view.total, pageno+1, rows_per_page)
     return {'objects': view.objects(),'pagination': pagination}
开发者ID:seyrenhe,项目名称:uliweb-myblog,代码行数:15,代码来源:views.py

示例6: test

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def test(self):
        from uliweb.utils.generic import ListView
        print functions
        #页面编号
        pageno = int(request.GET.get('page', 1)) - 1
        #每页文章数量,5为每页显示的文章
        rows_per_page = int(request.GET.get('rows', 8))
        print int(request.GET.get('rows', 1))
        #后面的参数为请求网址,所有记录数, 总页数, 每页文章数


        def modified_date(value, obj):
            return self._get_date(obj.modified_date)

        #fields_convert_map = {'modified_date': modified_date}

        #view = ListView(self.model, order_by=self.model.c.modified_time.desc(), pageno=pageno, rows_per_page=rows_per_page, fields_convert_map=fields_convert_map)
        view = ListView(self.model, order_by=self.model.c.modified_time.desc(), pageno=pageno, rows_per_page=rows_per_page)
        view.query()
        pagination = functions.create_pagination(request.url, view.total, pageno+1, rows_per_page)
        return {'objects': view.objects(),'pagination': pagination}
开发者ID:seyrenhe,项目名称:uliweb-myblog,代码行数:23,代码来源:views.py

示例7: index

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def index(self):
        """
        教程显示首页
        """
        from uliweb.utils.generic import ListView

        condition = (self.model.c.deleted==False)

        pageno = int(request.GET.get('page', 1)) - 1
        rows_per_page = int(request.GET.get('rows', 10))
        cateobjects = self.model_cate.all()

#        def render(r, obj):
#            from uliweb import Storage
#            
#            data = Storage(dict(r))
#            data['image'] = obj.get_image()
#            data['author'] = unicode(obj.modified_user)
#            data['modified_date'] = self._get_date(obj.modified_date)
#            return data

        def image(value, obj):
            return obj.get_image()
    
        def author(value, obj):
            return unicode(obj.modified_user)
        
        def modified_date(value, obj):
            return self._get_date(obj.modified_date)
        
        fields_convert_map = {'image':image, 'author':author, 'modified_date':modified_date}
        
        view = ListView(self.model, condition=condition, 
            order_by=self.model.c.modified_date.desc(), pageno=pageno,
            rows_per_page=rows_per_page, fields_convert_map=fields_convert_map)
            
        view.query()
        pagination = functions.create_pagination(request.url, view.total, pageno+1, 
            rows_per_page)
        return {'pagination':pagination, 'objects':view.objects(),'cateobjects':cateobjects}
开发者ID:kooksee,项目名称:uliwebzone,代码行数:42,代码来源:views.py

示例8: topic_view

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]

#.........这里部分代码省略.........
            get_user_image = function('get_user_image')
            try:
                url = get_user_image(obj.posted_by)
            except NotFound:
                url = get_user_image()
            return url
        
        def actions(value, obj):
            if not request.user:
                return ''
            
            a = []
            is_manager = forum.managers.has(request.user)
            if obj.floor == 1 and obj.parent == None:
                #第一楼为主贴,可以允许关闭,顶置等操作
                if is_manager:
                    a.append('<a href="#" rel="%d" class="close_thread">%s</a>' % (obj.id, self.status['close'][obj.topic.closed]))
                    a.append('<a href="#" rel="%d" class="hidden">%s</a>' % (obj.id, self.status['hidden'][obj.topic.hidden]))
                    a.append('<a href="#" rel="%d" class="top">%s</a>' % (obj.id, self.status['sticky'][obj.topic.sticky]))
                    a.append('<a href="#" rel="%d" class="essence">%s</a>' % (obj.id, self.status['essence'][obj.topic.essence]))
                    a.append('<a href="#" rel="%d" class="homepage">%s</a>' % (obj.id, self.status['homepage'][obj.topic.homepage]))
                if is_manager or (obj.posted_by.id == request.user.id and obj.created_on+timedelta(days=settings.get_var('PARA/FORUM_EDIT_DELAY'))>=date.now()):
                    #作者或管理员且在n天之内,则可以编辑
                    url = url_for(ForumView.edit_topic, forum_id=forum_id, topic_id=topic_id)
                    a.append('<a href="%s" rel="%d" class="edit">编辑</a>' % (url, obj.id))
                if is_manager:
                    url = url_for(ForumView.remove_topic, forum_id=forum_id, topic_id=topic_id)
                    a.append('<a href="%s" rel="%d" class="delete_topic">删除主题</a>' % (url, obj.id))
                #处理贴子转移,管理员可以转移
                if is_manager or request.user.is_superuser:
                    url = url_for(ForumView.move_topic, forum_id=forum_id, topic_id=topic_id)
                    a.append('<a href="%s" rel="%d" class="move_topic">移动主题</a>' % (url, obj.id))
                    
            if is_manager or (obj.posted_by.id == request.user.id):
                if (obj.deleted and (obj.deleted_by.id == request.user.id or is_manager)) or not obj.deleted:
                    a.append('<a href="#" rel="%d" class="delete">%s</a>' % (obj.id, self.status['delete'][obj.deleted]))
            try:
                obj.posted_by
                if obj.posted_by.id == request.user.id:    
                    a.append('<a href="#" rel="%d" class="email">%s</a>' % (obj.id, self.status['email'][obj.reply_email]))
            except NotFound:
                obj.posted_by = None
                obj.save()
            a.append('<a href="/%d/%d/%d/new_reply">回复该作者</a>' % (forum_id, topic_id, obj.id))
            return ' | '.join(a)
        
        def updated(value, obj):
            if obj.floor == 1 and obj.topic.updated_on and not obj.parent:
                return u'<div class="updated">由 %s 于 %s 更新</div>' % (obj.topic.modified_user.username, timesince(obj.topic.updated_on))
        
        fields = ['topic', 'id', 'username', 'userimage', 'posted_by', 'content',
            'created_on', 'actions', 'floor', 'updated', 'parent',
            ]
        fields_convert_map = {'created_on':created_on, 'content':content,
            'username':username, 'userimage':userimage, 'actions':actions,
            'updated':updated}
        #view1 为生成一级回复,即回复主题
        view1 = ListView(Post, fields=fields, condition=condition1, order_by=order_by,
            rows_per_page=rows_per_page, pageno=pageno,
            fields_convert_map=fields_convert_map)
        #view2 为生成二级乃至多级回复
        view2 = ListView(Post, fields=fields, condition=condition2, order_by=order_by,
            pagination=False,
            fields_convert_map=fields_convert_map)
        key = '__topicvisited__:forumtopic:%s:%s:%s' % (request.remote_addr, forum_id, topic_id)
        cache = function('get_cache')()
        v = cache.get(key, None)
        if not v:
            Topic.filter(Topic.c.id==int(topic_id)).update(num_views=Topic.c.num_views+1)
            cache.set(key, 1, settings.get_var('PARA/FORUM_USER_VISITED_TIMEOUT'))
        
        slug = uuid.uuid1().hex
        
        #处理posts和sub_posts
        query = view1.query()
        posts = []
        sub_posts = {}
        def process_sub(ids):
            _ids = []
            for x in Post.filter(Post.c.parent.in_(ids)).order_by(Post.c.floor):
                obj = view2.object(x)
                d = sub_posts.setdefault(str(x._parent_), [])
                d.append(obj)
                _ids.append(x.id)
            if _ids:
                process_sub(_ids)
                
        ids = []
        for row in query:
            posts.append(view1.object(row))
            ids.append(row.id)
            
        process_sub(ids)
           
        pagination = functions.create_pagination(request.path+'?'+request.query_string, view1.total,
            pageno+1, rows_per_page)
        return {'forum':forum, 'topic':topic, 'slug':slug, 
            'has_email':bool(request.user and request.user.email), 
            'page':pageno+1, 'pagination':pagination,
            'posts':posts, 'sub_posts':sub_posts}
开发者ID:qq40660,项目名称:forum2,代码行数:104,代码来源:views.py

示例9: forum_index

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
 def forum_index(self, id):
     """
     显示某论坛页面
     """
     from uliweb.utils.generic import ListView
     from sqlalchemy.sql import and_
     import math
     
     pageno = int(request.values.get('page', 1)) - 1
     rows_per_page=int(request.values.get('rows', settings.get_var('PARA/FORUM_INDEX_NUMS')))
     
     Topic = get_model('forumtopic')
     Forum = get_model('forum')
     User = get_model('user')
     forum = Forum.get(int(id))
     condition = Topic.c.forum == int(id)
     order_by = [Topic.c.sticky.desc(), Topic.c.last_reply_on.desc()]
     if not forum.managers.has(request.user):
         condition = (Topic.c.hidden==False) & condition
     
     filter = request.GET.get('filter', 'all')
     if filter == 'essence':
         condition = (Topic.c.essence==True) & condition
     elif filter == 'sticky':
         condition = (Topic.c.sticky==True) & condition
     term = request.GET.get('term', '')
     type = request.GET.get('type', '1')
     if term:
         if type == '1':     #查找主题
             condition = (Topic.c.subject.like('%'+term+'%')) & condition
         elif type == '2':   #查找用户名
             condition = and_(Topic.c.posted_by == User.c.id,
                 User.c.username.like('%' + term + '%') | User.c.nickname.like('%' + term + '%'),
                 ) & condition
         
     def created_on(value, obj):
         return value.strftime('%Y-%m-%d')
     
     def last_reply_on(value, obj):
         return timesince(value)
     
     def subject(value, obj):
         import cgi
         
         if obj.topic_type:
             _type = u'[%s]' % obj.get_display_value('topic_type')
         else:
             _type = ''
         s = ''
         if obj.sticky:
             s += u'<font color="red">[顶]</font>'
         if obj.hidden:
             s += u'<font color="red">[隐]</font>'
         if obj.closed:
             s += u'<font color="red">[关]</font>'
         if obj.essence:
             s += u'<font color="red">[精]</font>'
         if obj.homepage:
             s += u'<font color="red">[首]</font>'
         return _type+ '<a href="/%d/%d">%s</a>' % (int(id), obj.id, cgi.escape(obj.subject)) + s
     
     fields_convert_map = {'created_on':created_on, 'subject':subject,
         'last_reply_on':last_reply_on}
     view = ListView(Topic, condition=condition, order_by=order_by,
         rows_per_page=rows_per_page, pageno=pageno,
         fields_convert_map=fields_convert_map)
     view.query()    #in order to get the total count
     objects = view.objects()
     pages = int(math.ceil(1.0*view.total/rows_per_page))
     return {'forum':forum, 'objects':objects, 'filter':filter, 'term':term, 
         'page':pageno+1, 'total':view.total, 'pages':pages,
         'pagination':functions.create_pagination(request.path+'?'+request.query_string, view.total, pageno+1, rows_per_page),
         'type':type, 'filter_name':dict(settings.get_var('PARA/FILTERS')).get(filter)}
开发者ID:qq40660,项目名称:forum2,代码行数:75,代码来源:views.py

示例10: topic_view

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]

#.........这里部分代码省略.........
            if is_manager or (obj.posted_by.id == request.user.id):
                if (obj.deleted and (obj.deleted_by.id == request.user.id or is_manager)) or not obj.deleted:
                    a.append(
                        '<a href="#" rel="%d" class="delete">%s</a>' % (obj.id, self.status["delete"][obj.deleted])
                    )
            if obj.posted_by.id == request.user.id:
                a.append('<a href="#" rel="%d" class="email">%s</a>' % (obj.id, self.status["email"][obj.reply_email]))
            a.append('<a href="/forum/%d/%d/%d/new_reply">回复该作者</a>' % (forum_id, topic_id, obj.id))
            return " | ".join(a)

        def updated(value, obj):
            if obj.floor == 1 and obj.topic.updated_on and not obj.parent:
                return u'<div class="updated">由 %s 于 %s 更新</div>' % (
                    obj.topic.modified_user.username,
                    timesince(obj.topic.updated_on),
                )

        fields = [
            "topic",
            "id",
            "username",
            "userimage",
            "posted_by",
            "content",
            "created_on",
            "actions",
            "floor",
            "updated",
            "parent",
        ]
        fields_convert_map = {
            "created_on": created_on,
            "content": content,
            "username": username,
            "userimage": userimage,
            "actions": actions,
            "updated": updated,
        }
        # view1 为生成一级回复,即回复主题
        view1 = ListView(
            Post,
            fields=fields,
            condition=condition1,
            order_by=order_by,
            rows_per_page=rows_per_page,
            pageno=pageno,
            fields_convert_map=fields_convert_map,
        )
        # view2 为生成二级乃至多级回复
        view2 = ListView(
            Post,
            fields=fields,
            condition=condition2,
            order_by=order_by,
            pagination=False,
            fields_convert_map=fields_convert_map,
        )
        key = "__topicvisited__:forumtopic:%s:%s:%s" % (request.remote_addr, forum_id, topic_id)
        cache = function("get_cache")()
        v = cache.get(key, None)
        if not v:
            Topic.filter(Topic.c.id == int(topic_id)).update(num_views=Topic.c.num_views + 1)
            cache.set(key, 1, settings.get_var("PARA/FORUM_USER_VISITED_TIMEOUT"))

        slug = uuid.uuid1().hex
        topic = Topic.get(int(topic_id))

        # 处理posts和sub_posts
        query = view1.query()
        posts = []
        sub_posts = {}

        def process_sub(ids):
            _ids = []
            for x in Post.filter(Post.c.parent.in_(ids)).order_by(Post.c.floor):
                obj = view2.object(x)
                d = sub_posts.setdefault(str(x._parent_), [])
                d.append(obj)
                _ids.append(x.id)
            if _ids:
                process_sub(_ids)

        ids = []
        for row in query:
            posts.append(view1.object(row))
            ids.append(row.id)

        process_sub(ids)

        pagination = functions.create_pagination(request.url, view1.total, pageno + 1, rows_per_page)
        return {
            "forum": forum,
            "topic": topic,
            "slug": slug,
            "has_email": bool(request.user and request.user.email),
            "page": pageno + 1,
            "pagination": pagination,
            "posts": posts,
            "sub_posts": sub_posts,
        }
开发者ID:tangjn,项目名称:plugs,代码行数:104,代码来源:views.py

示例11: forum_index

# 需要导入模块: from uliweb.utils.generic import ListView [as 别名]
# 或者: from uliweb.utils.generic.ListView import query [as 别名]
    def forum_index(self, id):
        """
        显示某论坛页面
        """
        from uliweb.utils.generic import ListView
        from sqlalchemy.sql import and_
        import math

        pageno = int(request.values.get("page", 1)) - 1
        rows_per_page = int(request.values.get("rows", settings.get_var("PARA/FORUM_INDEX_NUMS")))

        Topic = get_model("forumtopic")
        Forum = get_model("forum")
        User = get_model("user")
        forum = Forum.get(int(id))
        condition = Topic.c.forum == int(id)
        order_by = [Topic.c.sticky.desc(), Topic.c.last_reply_on.desc()]
        if not forum.managers.has(request.user):
            condition = (Topic.c.hidden == False) & condition

        filter = request.GET.get("filter", "all")
        if filter == "essence":
            condition = (Topic.c.essence == True) & condition
        elif filter == "sticky":
            condition = (Topic.c.sticky == True) & condition
        term = request.GET.get("term", "")
        type = request.GET.get("type", "1")
        if term:
            if type == "1":  # 查找主题
                condition = (Topic.c.subject.like("%" + term + "%")) & condition
            elif type == "2":  # 查找用户名
                condition = (
                    and_(
                        Topic.c.posted_by == User.c.id,
                        User.c.username.like("%" + term + "%") | User.c.nickname.like("%" + term + "%"),
                    )
                    & condition
                )

        def created_on(value, obj):
            return value.strftime("%Y-%m-%d")

        def last_reply_on(value, obj):
            return timesince(value)

        def subject(value, obj):
            if obj.topic_type:
                _type = u"[%s]" % obj.get_display_value("topic_type")
            else:
                _type = ""
            s = ""
            if obj.sticky:
                s += u'<font color="red">[顶]</font>'
            if obj.hidden:
                s += u'<font color="red">[隐]</font>'
            if obj.closed:
                s += u'<font color="red">[关]</font>'
            if obj.essence:
                s += u'<font color="red">[精]</font>'
            if obj.homepage:
                s += u'<font color="red">[首]</font>'
            return _type + '<a href="/forum/%d/%d">%s</a>' % (int(id), obj.id, obj.subject) + s

        fields_convert_map = {"created_on": created_on, "subject": subject, "last_reply_on": last_reply_on}
        view = ListView(
            Topic,
            condition=condition,
            order_by=order_by,
            rows_per_page=rows_per_page,
            pageno=pageno,
            fields_convert_map=fields_convert_map,
        )
        view.query()  # in order to get the total count
        objects = view.objects()
        pages = int(math.ceil(1.0 * view.total / rows_per_page))
        return {
            "forum": forum,
            "objects": objects,
            "filter": filter,
            "term": term,
            "page": pageno + 1,
            "total": view.total,
            "pages": pages,
            "pagination": functions.create_pagination(request.url, view.total, pageno + 1, rows_per_page),
            "type": type,
            "filter_name": dict(settings.get_var("PARA/FILTERS")).get(filter),
        }
开发者ID:tangjn,项目名称:plugs,代码行数:89,代码来源:views.py


注:本文中的uliweb.utils.generic.ListView.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。