Skip to content

Commit

Permalink
feature(): complete part of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eastwu5788 committed May 14, 2020
1 parent 8a7b95b commit 83ae51b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 0 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Unreleased

- TODO: 支持文件入参处理能力
- TODO: 支持Flask扩展集成形式
- TODO: 所有文档、注释去中文

Version 2.0.10
-------------------------
Expand Down
17 changes: 17 additions & 0 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ pre-request 提供了一个全局单例 `pre` 对象,我们可以通过操作
- `pre.content_type` 设置pre-request的错误响应格式,目前支持 `application/json` 和 `text/html`


`Flask` 扩展支持
------------------

pre-request 提供了基于Flask扩展方式配置参数的能力。


.. code-block:: python
app = Flask(__name__)
app.config["PRE_FUZZY"] = True
app.config["PRE_STORE_KEY"] = "pp"
app.config["PRE_CONTENT_TYPE"] = "application/json"
pre.init_app(app=app)
`@pre.catch` 装饰器介绍
-------------------------

Expand Down
5 changes: 1 addition & 4 deletions pre_request/filters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@


class BaseFilter:
""" Base class for filter object
"""
过滤器基类
"""
# 错误码
error_code = 500

def __init__(self, key, value, rule):
"""
Expand Down
2 changes: 1 addition & 1 deletion pre_request/filters/simple/location_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class LocationFilter(BaseFilter):
"""地址位置过滤器
""" 地址位置过滤器
"""
latitude_error_code = 590
longitude_error_code = 591
Expand Down
3 changes: 0 additions & 3 deletions pre_request/rules.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
"""
该文件主要定义所有的规则处理类
"""
from datetime import datetime


Expand Down

0 comments on commit 83ae51b

Please sign in to comment.