def create_or_resurrect_dir(tp, name, parent):
 try:
  directory = Directory.objects.get(parent=parent, name=name)
  directory.obsolete = False
 except Directory.DoesNotExist:
  directory = Directory(name=name, parent=parent, tp=tp)
 return directory

def create_or_resurrect_dir ( tp , name , parent ) : try : directory = Directory . objects . get ( parent = parent , name = name ) directory . obsolete = False except Directory . DoesNotExist : directory = Directory ( name = name , parent = parent , tp = tp ) return directory
create or resurrect a directory db item with given name and parent .