Re: Syntax error with render_to_response call

2007-01-25 Thread Tipan

Hi Christian,

I think you are right, I was using a PHP IDE as my editor and when I
reverted to Notepad, it showed a different layout. I modified it and it
worked fine. Really frustrating and such a waste of time.

Is there a popular IDE that makes editing quick and easy?

Tim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Syntax error with render_to_response call

2007-01-25 Thread Christian Joergensen
Tipan wrote:
> def codeview(request):
> manipulator = CodeViewManipulator()
> if request.method == 'POST':
> new_data = request.POST.copy()
> errors = manipulator.get_validation_errors(new_data)
>   if not errors:
> 
>   return HttpResponseRedirect("/hive/codeoutput/")
> else:
> errors = new_data = {}
> code_list=CodeTest.objects.all()
> return render_to_response('codeview.html', {'code_list':code_list})
> 
> This always generates a Django Syntax Error on the return
> render_to_response line. I can define a new view with just the last two
> lines and it works fine. The function also runs if I substitute a
> return HttpResponse line instead of the render_to_response, but then it
> won't display my html template page.
> 
> Is there some ruling preventing me from using render_to_response in
> this way?
> 
> Any advice welcome - it's driving me crazy!

Could it be a case of tab vs. spaces indentation? What more that Syntax
Error does the django error page tell you?

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  | Visit us at: http://www.gmta.info



signature.asc
Description: OpenPGP digital signature


Syntax error with render_to_response call

2007-01-25 Thread Tipan

I have a problem that is causing me some grief and I can't seem to
found a reason for it. I'm relatively new to Django and Python so it is
likely to be something simple.

I have a function that displays a form and some data from a table. If
the form data is correct, it generates some new lines of data in the
table and displays another page. However, I get a Syntax error from my
render_to_response line in the function. Code is as follows in View.py:

def codeview(request):
manipulator = CodeViewManipulator()
if request.method == 'POST':
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:

return HttpResponseRedirect("/hive/codeoutput/")
else:
errors = new_data = {}
code_list=CodeTest.objects.all()
return render_to_response('codeview.html', {'code_list':code_list})

This always generates a Django Syntax Error on the return
render_to_response line. I can define a new view with just the last two
lines and it works fine. The function also runs if I substitute a
return HttpResponse line instead of the render_to_response, but then it
won't display my html template page.

Is there some ruling preventing me from using render_to_response in
this way?

Any advice welcome - it's driving me crazy!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---