def set_due_date_extension(course, unit, student, due_date):
 if due_date:
  with disable_overrides():
   original_due_date = getattr(unit, 'due', None)
  if (not original_due_date):
   raise DashboardError(_('Unit {0} has no due date to extend.').format(unit.location))
  if (due_date < original_due_date):
   raise DashboardError(_('An extended due date must be later than the original due date.'))
  override_field_for_user(student, unit, 'due', due_date)
 else:
  if (not get_override_for_user(student, unit, 'due')):
   raise DashboardError(_('No due date extension is set for that student and unit.'))
  clear_override_for_user(student, unit, 'due')

def set_due_date_extension ( course , unit , student , due_date ) : if due_date : with disable_overrides ( ) : original_due_date = getattr ( unit , 'due' , None ) if ( not original_due_date ) : raise DashboardError ( _ ( 'Unit {0} has no due date to extend.' ) . format ( unit . location ) ) if ( due_date < original_due_date ) : raise DashboardError ( _ ( 'An extended due date must be later than the original due date.' ) ) override_field_for_user ( student , unit , 'due' , due_date ) else : if ( not get_override_for_user ( student , unit , 'due' ) ) : raise DashboardError ( _ ( 'No due date extension is set for that student and unit.' ) ) clear_override_for_user ( student , unit , 'due' )
sets a due date extension .