def generate_view_function(self, source, target):
    tgv = TaggedValues(source)
    func = read_target_node(source, target.target)
    
    if IPythonClass.providedBy(func.parent):
        # We have a method
        module = func.parent.parent
        klass = source.parent
        token(str(klass.uuid), True, has_view_methods=True)
        is_method = True
    else:
        module = func.parent
        is_method = False
    
    imps = Imports(module)
        
    funccode = "return Response('this is the stub for view %s')" % source.name
    
    # name of view
    route_name = tgv.direct('route_name', 'pyramid:view', source.name)
    if route_name == '/':
        route_name = ''
        
    if not func.decorators('view_config'):
        func.insertfirst(Decorator('view_config'))
    
    dec = func.decorators('view_config')[0]
    dec.kwargs['name'] = "'%s'" % route_name
    
    # necessary imports
    imps.set('pyramid.view', 'view_config')
    
    # the request argument
    if not is_method and not 'request' in func.args:
        func.args.append('request')
        
    # create the page template
    template = tgv.direct('template', 'pyramid:view', None)
    # template from which the template file will be generated
    from_template = tgv.direct('from_template', 'pyramid:view', None)
    if from_template and from_template != 'none' and not template:
        template = source.name + '.pt'
        
    print 'template name:', template, from_template
    if template:
        tdir = module.parent
        # set the renderer parameter based on the template name
        dec.kwargs['renderer'] = "'%s'" % template
    
        # create the template in target dir
        template_code = tgv.direct('template_code', 'pyramid:view', None)
        create_template_file(tdir, template, from_template, template_code=template_code and template_code.strip())   
                 
        # generate default function body
        funccode = '''return {"page_title": "%s"}''' % source.name
    
    # if given set the renderer parameter
    renderer = tgv.direct('renderer', 'pyramid:view', None)
    if renderer and not dec.kwargs.get('renderer'):
        dec.kwargs['renderer'] = "'%s'" % renderer
        
    # if view function is empty, make a default code displaying info
    if not func.blocks():
        func.insertfirst(Block(funccode))
        imps.set('pyramid.response', 'Response')