pytask/taskapp/utils.py
author Nishanth Amuluru <nishanth@fossee.in>
Sat, 08 Jan 2011 23:47:06 +0530
changeset 105 94dd9d25d52a
child 106 aa61ea9c29f9
permissions -rw-r--r--
Added utils to taskapp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
105
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     1
from pytask.taskapp.models import Task
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     2
from django.http import Http404
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     3
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     4
def getTask(tid):
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     5
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     6
    try:
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     7
        task = Task.objects.exclude(status="DL").get(uniq_key=tid)
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     8
        return task
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     9
    except Task.DoesNotExist:
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    10
        raise Http404
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    11