Taking out the first part of the code, resolves the error.

Perhaps because render_to_response for my-blog.mak is occuring twice?

In the first part of the code you have return
render_to_response('myblog:templates/pages/%s.mak'%path,

Which renders my-blog.mak if it exists,

The second time I do:

def blog_view(request):
   variable = 'hello world'
   return render_to_respomse('myblog:templates/pages/my-blog.mak',
{'variable':variable}, request=request)

The thing is I need something first renders the templates if they
exist or not and are in the database table.
The second part is creating some seperate logic to go inside that
template.

Kind Regards,
Awais M.


On Mar 12, 11:40 pm, Michael Merickel <[email protected]> wrote:
> That error is telling me that you have a bug in your mako template...
> probably referencing a variable that you forgot to pass in (thus it is
> undefined).
>
> Michael
>
> On Sat, Mar 12, 2011 at 4:33 PM, AwaisMuzaffar 
> <[email protected]>wrote:
>
>
>
> > Hi,
>
> > Thanks I will read into it more. I assumed it was the same thing.
>
> > I have also tried:
>
> > def blog_view(request):
> >   variable = 'hello world'
> >   return render_to_respomse('myblog:templates/pages/my-blog.mak',
> > {'variable':variable}, request=request)
>
> > And, I recieve the following error:
>
> > URL:http://127.0.0.1:6543/my-blog/
> >    File '/Users/Awais/virtualenv/lib/python2.6/site-packages/
> > WebError-0.10.3-py2.6.egg/weberror/evalexception.py', line 431 in
> > respond
> >  app_iter = self.application(environ, detect_start_response)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/
> > repoze.tm2-1.0b1-py2.6.egg/repoze/tm/__init__.py', line 23 in __call__
> >  result = self.application(environ, save_status_and_headers)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/router.py', line 158 in __call__
> >  response = view_callable(context, request)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/config.py', line 2916 in _requestonly_view
> >  response = view(request)
> > File '/Users/Awais/virtualenv/MyBlog/myblog/views.py', line 25 in
> > pages_view
> >  {'page':page}, request=request)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/renderers.py', line 111 in render_to_response
> >  return helper.render_to_response(value, None, request=request)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/renderers.py', line 322 in render_to_response
> >  result = self.render(value, system_values, request=request)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/renderers.py', line 318 in render
> >  result = renderer(value, system_values)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/pyramid-1.0-
> > py2.6.egg/pyramid/mako_templating.py', line 131 in __call__
> >  result = template.render_unicode(**system)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/Mako-0.3.6-
> > py2.6.egg/mako/template.py', line 292 in render_unicode
> >  as_unicode=True)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/Mako-0.3.6-
> > py2.6.egg/mako/runtime.py', line 575 in _render
> >  **_kwargs_for_callable(callable_, data))
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/Mako-0.3.6-
> > py2.6.egg/mako/runtime.py', line 607 in _render_context
> >  _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/Mako-0.3.6-
> > py2.6.egg/mako/runtime.py', line 633 in _exec_template
> >  callable_(context, *args, **kwargs)
> > File 'myblog_templates_pages____base_mak', line 27 in render_body
> > File 'myblog_templates_pages_my_blog_mak', line 34 in render_body
> > File '/Users/Awais/virtualenv/lib/python2.6/site-packages/Mako-0.3.6-
> > py2.6.egg/mako/runtime.py', line 181 in __str__
> >  raise NameError("Undefined")
> > NameError: Undefined
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pylons-discuss" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/pylons-discuss?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to