Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.66
diff -u -p -r1.66 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	23 Aug 2009 01:05:12 -0000	1.66
+++ modules/taxonomy/taxonomy.admin.inc	23 Aug 2009 03:14:28 -0000
@@ -668,7 +668,8 @@ function taxonomy_form_term(&$form_state
     'description' => '',
     'vocabulary_machine_name' => $vocabulary->machine_name,
     'tid' => NULL,
-    'weight' => 0,
+    // Using empty string for simulating empty user input.
+    'weight' => '',
   );
 
   // Take into account multi-step rebuilding.
@@ -749,8 +750,7 @@ function taxonomy_form_term(&$form_state
     '#title' => t('Weight'),
     '#size' => 6,
     '#default_value' => $edit['weight'],
-    '#description' => t('Terms are displayed in ascending order by weight.'),
-    '#required' => TRUE);
+    '#description' => t('Terms are displayed in ascending order by weight. By default, the term will be appended to the end of the term list.'));
   $form['vid'] = array(
     '#type' => 'value',
     '#value' => $vocabulary->vid);
@@ -782,8 +782,8 @@ function taxonomy_form_term_validate($fo
   field_attach_form_validate('taxonomy_term', (object) $form_state['values'], $form, $form_state);
 
   // Ensure numeric values.
-  if (isset($form_state['values']['weight']) && !is_numeric($form_state['values']['weight'])) {
-    form_set_error('weight', t('Weight value must be numeric.'));
+  if (isset($form_state['values']['weight']) && !(is_numeric($form_state['values']['weight']) || $form_state['values']['weight'] === "")) {
+    form_set_error('weight', t('Weight value must be numeric or left empty.'));
   }
 }
 
@@ -812,6 +812,24 @@ function taxonomy_form_term_submit($form
 
   $term = taxonomy_form_term_submit_builder($form, $form_state);
 
+  // Term with empty weight is appended to the end by setting its weight to
+  // "maximum weight + 1".
+  if ($term->weight === '') {
+
+    // Fetch the max weight.
+    $max_weight = db_query("SELECT MAX(weight) FROM {taxonomy_term_data} WHERE vid = :vid", array(':vid' => $term->vid))->fetchField();
+
+    // No terms available in vocabulary, set weight to 0.
+    if ($max_weight == NULL) {
+      $term->weight = 0;
+    }
+    // Terms available, set weight to max + 1.
+    else {
+      $term->weight = $max_weight + 1;
+    }
+  }
+
+
   $status = taxonomy_term_save($term);
   switch ($status) {
     case SAVED_NEW:
