Skip to content

Commit

Permalink
bump version 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
staugur committed Jun 22, 2021
1 parent f2aee31 commit d8aec0e
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 157 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.. currentmodule:: flask-pluginkit

v3.6.1
------

Released in 2021-06-22

- ci tests from travis to github action
- chore: web message api with SSE, page with CDN

v3.6.0
------

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Submit pull request
* git clone Flask-PluginKit under your account and set your `git config`

* Install the dependency module of the development environment
with command ``pip install -r dev-requirements.txt``
with command ``make dev``

**Followed by coding**

Expand All @@ -43,7 +43,7 @@ Submit pull request
* Write test cases and documentation.

* Run the test ``make dev && make test`` using the pypy, py2.7,
and py3.5+ environments respectively.
and py3.6+ environments respectively.

* Generate the documentation ``make dev && make html``.

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ END

Welcome to submit pull request and star.

.. |Build Status| image:: https://travis-ci.org/staugur/Flask-PluginKit.svg?branch=master
:target: https://travis-ci.org/staugur/Flask-PluginKit
.. |Build Status| image:: https://github.com/staugur/Flask-PluginKit/actions/workflows/ci.yml/badge.svg
:target: https://github.com/staugur/Flask-PluginKit/actions/workflows/ci.yml
.. |Documentation Status| image:: https://open.saintic.com/rtfd/badge/flask-pluginkit
:target: https://flask-pluginkit.rtfd.vip
.. |codecov| image:: https://codecov.io/gh/staugur/Flask-PluginKit/branch/master/graph/badge.svg
Expand Down
2 changes: 1 addition & 1 deletion docs/locale/zh_CN/LC_MESSAGES/api.po
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ msgstr ""
#: flask_pluginkit.PluginManager.emit_assets:25 of
msgid ""
"However, the ``_raw`` parameter has been added in v3.4.0, and if it is "
"True, only uri is generated."
"True, only path is generated."
msgstr ""

#: flask_pluginkit.PluginManager.emit_assets:28 of
Expand Down
8 changes: 4 additions & 4 deletions docs/locale/zh_CN/LC_MESSAGES/contributing.po
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ msgstr "克隆Flask-PluginKit,并设置好个人的 `git config`"
#: ../../../CONTRIBUTING.rst:36
msgid ""
"Install the dependency module of the development environment with command"
" ``pip install -r dev-requirements.txt``"
msgstr "使用命令 ``pip install -r dev-requirements.txt`` 安装开发环境依赖的模块"
" ``make dev``"
msgstr "使用命令 ``make dev`` 安装开发环境依赖的模块"

#: ../../../CONTRIBUTING.rst:39
msgid "**Followed by coding**"
Expand All @@ -105,9 +105,9 @@ msgstr "编写测试用例和文档。"

#: ../../../CONTRIBUTING.rst:45
msgid ""
"Run the test ``make dev && make test`` using the pypy, py2.7, and py3.5+ "
"Run the test ``make dev && make test`` using the pypy, py2.7, and py3.6+ "
"environments respectively."
msgstr "分别使用pypy、py2.7、py3.5+运行测试 ``make dev && make test``"
msgstr "分别使用pypy、py2.7、py3.6+运行测试 ``make dev && make test``"

#: ../../../CONTRIBUTING.rst:48
msgid "Generate the documentation ``make dev && make html``."
Expand Down
4 changes: 2 additions & 2 deletions docs/locale/zh_CN/LC_MESSAGES/installation.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ msgstr "Python版本"
#: ../../installation.rst:9
msgid ""
"We recommend using the latest version of Python 3, although it is code "
"written in 2.7. Flask-PluginKit supports Python 3.5 and newer, Python "
"written in 2.7. Flask-PluginKit supports Python 3.6 and newer, Python "
"2.7, and PyPy."
msgstr "推荐使用Python3+,虽然我是在2.7下开发的。Flask-PluginKit支持3.5及新版,2.7和pypy。"
msgstr "推荐使用Python3+,虽然我是在2.7下开发的。Flask-PluginKit支持3.6及新版,2.7和pypy。"

#: ../../installation.rst:13
msgid "Dependencies"
Expand Down
27 changes: 16 additions & 11 deletions examples/fulldemo/plugins/local_demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
bp = Blueprint(__plugin_name__, __plugin_name__)


@bp.route('/')
@bp.route("/")
def index():
return jsonify(dict(hello="localdemo"))

Expand All @@ -30,28 +30,33 @@ def br():
local = LocalStorage()
local.set(
"nowtime",
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())),
)


def view_limit(path):
if request.method == "GET":
return jsonify(dict(method='GET', status=200, path=path))
return jsonify(dict(method="GET", status=200, path=path))
else:
return jsonify(dict(method=request.method, status=403, path=path))


def page_not_found(error):
return jsonify(dict(status=404, msg="Not Found Page")),404
return jsonify(dict(status=404, msg="Not Found Page")), 404


def register():
return {
"tep": dict(code=u'<p>hello local-demo(from html code)</p>', html='localdemo/title.html'),
'hep': dict(before_request=br),
'bep': dict(blueprint=bp, prefix='/localdemo'),
'vep': dict(rule='/limit/<path>', view_func=view_limit, methods=['GET', 'POST']),
'filter': [('demo_filter2', lambda x: 'test-filter')],
'errhandler': {404: page_not_found},
'tcp': dict(timestamp=int(time.time())),
"tep": dict(
code=u"<p>hello local-demo(from html code)</p>",
html="localdemo/title.html",
),
"hep": dict(before_request=br),
"bep": dict(blueprint=bp, prefix="/localdemo"),
"vep": dict(
rule="/limit/<path>", view_func=view_limit, methods=["GET", "POST"]
),
"filter": [("demo_filter2", lambda x: "test-filter")],
"errhandler": {404: page_not_found},
"tcp": dict(timestamp=int(time.time())),
}
20 changes: 9 additions & 11 deletions examples/fulldemo/plugins/repeat_demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def permission_deny(error):


class ApiError(Exception):

def __init__(self, code, message, status_code=200):
super(ApiError, self).__init__()
self.code = code
Expand All @@ -49,7 +48,6 @@ def raise_api_error_view():


class ClassfulView(FlaskView):

def index(self):
return "test"

Expand All @@ -60,16 +58,16 @@ def bvep_view():

def register():
return {
'cvep': dict(view_class=ClassfulView),
'vep': [
dict(rule='/403', view_func=view_abort_403),
dict(rule='/api_error', view_func=raise_api_error_view),
dict(rule='/bvep', view_func=bvep_view, _blueprint="localdemo"),
"cvep": dict(view_class=ClassfulView),
"vep": [
dict(rule="/403", view_func=view_abort_403),
dict(rule="/api_error", view_func=raise_api_error_view),
dict(rule="/bvep", view_func=bvep_view, _blueprint="localdemo"),
],
'filter': dict(repeat_filter=lambda x: 'test-filter-repeat'),
'errhandler': [
"filter": dict(repeat_filter=lambda x: "test-filter-repeat"),
"errhandler": [
dict(error=403, handler=permission_deny),
dict(error=ApiError, handler=handle_api_error)
dict(error=ApiError, handler=handle_api_error),
],
'tcp': dict(change_to_str=str),
"tcp": dict(change_to_str=str),
}
2 changes: 1 addition & 1 deletion flask_pluginkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__author__ = "staugur <[email protected]>"

__version__ = "3.6.0"
__version__ = "3.6.1"

__all__ = [
"Flask",
Expand Down
11 changes: 10 additions & 1 deletion flask_pluginkit/_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,13 @@ def msg():
msg = _queue.popleft()
except IndexError:
msg = ""
return jsonify(dict(code=0, msg=msg))
accept = request.headers.get("Accept")
if accept and "application/json" in accept:
return jsonify(dict(code=0, msg=msg))
else:
# SSE(server-sent events)
res = make_response("retry: 10000\ndata: %s\n\n" % msg)
res.headers["Content-Type"] = "text/event-stream"
res.headers["Cache-Control"] = "no-cache"
res.headers["Connection"] = "keep-alive"
return res
5 changes: 2 additions & 3 deletions flask_pluginkit/pluginkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,16 +1143,15 @@ def emit_assets(self, plugin_name, filename, _raw=False, _external=False):
If filename ends with `.js`, then this function will
return the `script` code, like this::
<script type="text/javascript" src="/assets/plugin/js/demo.js">
</script>
<script type="text/javascript" src="/assets/plugin/js/demo.js"></script>
Other types of files, only return file url path segment, like this::
/assets/plugin/img/logo.png
/assets/plugin/attachment/test.zip
However, the ``_raw`` parameter has been added in v3.4.0, and if it is
True, only uri is generated.
True, only path is generated.
The following is a mini example::
Expand Down
1 change: 0 additions & 1 deletion flask_pluginkit/static/bulma-0.7.5.min.css

This file was deleted.

2 changes: 0 additions & 2 deletions flask_pluginkit/static/jquery-3.4.1.min.js

This file was deleted.

Loading

0 comments on commit d8aec0e

Please sign in to comment.