zetaops / zengine

BPMN workflow based framework with Tornado, Rabbit AMQP, advanced permissions, extensible scaffolding features and more
GNU General Public License v3.0
83 stars 22 forks source link

Decorator based non-workflow views and jobs #5473 #87

Closed zetaopsbot closed 7 years ago

zetaopsbot commented 7 years ago

In our existing framework, any non-workflow view should be defined under settings.VIEW_URLS. To simplify this workflow, I'm going to refactor this into a decorator based form.


from zengine.lib.decorators import view

@view() # this creates a mapping with "_zops_" prefix. ie: _zops_mark_offline_user
def mark_offline_user(current):
    current.user.is_online(False)

# OR

@view('custom_path') # this creates: _zops_custom_path
def mark_offline_user(current):
    current.user.is_online(False)

For background jobs, I'm also going to create a @bg_job decorator which will work in the same way with @view.

zengine