www/src/py_generator.js
function jscode_namespace(iter_name, action, parent_id) {
    var _clean= '';
    if (action === 'store') {
        _clean = ' = {}'
    }
    var res = 'for(var attr in this.blocks){' +
              'eval("var " + attr + " = this.blocks[attr]")'+
           '};' +
           'var $locals_' + iter_name + ' = this.env' + _clean + ', '+
               '$local_name = "' + iter_name + '", ' +
               '$locals = $locals_' + iter_name + ';'
    if(parent_id){
        res += '$locals.$parent = $locals_' + parent_id.replace(/\./g, "_") +
            ';'
    }
    return res
}
function jscode_namespace(iter_name, action, parent_id) {
    var _clean= '';
    if (action === 'store') {
        _clean = ' = {}'
    }
    var res = 'for(var attr in this.blocks){' +
              'eval("var " + attr + " = this.blocks[attr]")'+
           '};' +
           'var $locals_' + iter_name + ' = this.env' + _clean + ', '+
               '$local_name = "' + iter_name + '", ' +
               '$locals = $locals_' + iter_name + ';'
    if(parent_id){
        res += '$locals.$parent = $locals_' + parent_id.replace(/\./g, "_") +
            ';'
    }
    return res
}
Code to store/restore local namespace  In generators, the namespace is stored in an attribute of the generator function until the iterator is exhausted, so that it can be restored in the next iteration