Skip to content

Latest commit

 

History

History
84 lines (58 loc) · 2.81 KB

architecture.rst

File metadata and controls

84 lines (58 loc) · 2.81 KB

New Architecture

old_architecture is good, but it does not allow use tree structure of resources and has hard depency from SQLAlchemy, sacrud, sacrud_deform etc... This is not flexible solution. A new generation of pyramid_sacrud >= 0.3.0 represent just interface for any backends, like:

  • ps_alchemy - handle SQLAlchemy resourse
  • ps_peewee - handle PeeweeORM resourse
  • ps_ponyorm - handle PonyORM resourse
  • ps_djangoorm - handle Django ORM resourse
  • ps_mongodb - handle MongoDB resourse
  • and unniversal interface writing your own backends for example:
    • you can write filesystem backend which shown files in pyramid_sacrud and provide to you CRUD operations.
    • OS process backend shown process in pyramid_sacrud and allow to kill it
    • and all you can come to mind.

ziggform* - it's abstract modules, this is what needs to be done. I like the idea of ziggurat_form so I use such names.

Old Architecture

Main page

He takes all the resources of the settings to return them to the template home.jinja2. It implemented in pyramid_sacrud.views.sa_home.

List of rows

He takes all rows of resource, paginate it and return to template list.jinja2. It implemented in pyramid_sacrud.views.CRUD.List. For select action used sacrud and sacrud.action.CRUD.read.

Delete row

He delete selected row and redirect to list of rows. It implemented in pyramid_sacrud.views.CRUD.Delete. For delete action used sacrud and sacrud.action.CRUD.delete.

Form for CREATE/DELETE action

If you send GET request it return HTML form for your module. To generate form it used sacrud_deform. sacrud_deform generate form with schema from ColanderAlchemy and widgets from deform. The main task of sacrud_deform is choose the right widgets from deform and make select widget for relationships. It implemented in pyramid_sacrud.views.CRUD.Add and used template create.jinja2.

POST request for CREATE/DELETE action

If you send POST request it validate form and do create/update action from sacrud respectively sacrud.action.CRUD.create and sacrud.action.CRUD.update. It implemented in pyramid_sacrud.views.CRUD.Add.