Re: None model error handling in view

2008-11-09 Thread Daniel Roseman
On Nov 9, 12:28 pm, VP <[EMAIL PROTECTED]> wrote: > Unfortunatelly I don't know how to get that traceback. > If the exception happens from a model e.g. > > try: >     b = Blog.objects.get(id = 1) > except Blog.DoesNotExist: >     b = Blog(name = 'MyBlog') >     b.save() >     b = b.id > > It works

Re: None model error handling in view

2008-11-09 Thread VP
Unfortunatelly I don't know how to get that traceback. If the exception happens from a model e.g. try: b = Blog.objects.get(id = 1) except Blog.DoesNotExist: b = Blog(name = 'MyBlog') b.save() b = b.id It works very well. But following not: try: for row in csv.reader(request

Re: None model error handling in view

2008-11-09 Thread Daniel Roseman
On Nov 9, 3:00 am, VP <[EMAIL PROTECTED]> wrote: > Hi all, > > How to handle errors from different modules, for example CSV or > DATETIME in view? > I am trying to parse CSV content in my view after an uplod a file by > user. > > def my_view(request): >     ... >     try: >         for row in csv.

None model error handling in view

2008-11-08 Thread VP
Hi all, How to handle errors from different modules, for example CSV or DATETIME in view? I am trying to parse CSV content in my view after an uplod a file by user. def my_view(request): ... try: for row in csv.reader(request.FILES['file']): for i in range(0, len(row)