Skip to content

Instantly share code, notes, and snippets.

@petrjasek
Created September 4, 2014 14:54
Show Gist options
  • Select an option

  • Save petrjasek/784ed120096d9a223133 to your computer and use it in GitHub Desktop.

Select an option

Save petrjasek/784ed120096d9a223133 to your computer and use it in GitHub Desktop.

Revisions

  1. petrjasek created this gist Sep 4, 2014.
    27 changes: 27 additions & 0 deletions layers.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@

    def controller_layer(doc):
    doc['ctr'] = 1
    yield doc
    doc['ctr'] = 2
    return doc

    def service_layer(doc):
    doc['srv'] = 1
    yield doc
    doc['srv'] = 2
    return doc

    def data_layer(doc):
    doc['data'] = 1
    yield doc
    doc['data'] = 2
    return doc

    x = {}

    for doc in controller_layer(x):
    for doc in service_layer(x):
    for doc in data_layer(x):
    print('save', doc)

    print('done', x)