? patches
Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.56.2.36
diff -u -p -r1.56.2.36 pathauto.inc
--- pathauto.inc	12 Aug 2010 15:10:58 -0000	1.56.2.36
+++ pathauto.inc	23 Sep 2010 15:30:09 -0000
@@ -632,7 +632,7 @@ function _pathauto_verbose($message = NU
  *   Pathauto expects to see them.
  */
 function pathauto_get_placeholders($type, $object) {
-  $full = token_get_values($type, $object, TRUE);
+  $full = token_get_values($type, $object, TRUE, array('pathauto' => TRUE));
   $tokens = token_prepare_tokens($full->tokens);
   $values = pathauto_clean_token_values($full);
   return array('tokens' => $tokens, 'values' => $values);
@@ -653,17 +653,20 @@ function pathauto_clean_token_values($fu
   foreach ($full->values as $key => $value) {
     // Only clean non-path tokens.
     $token = $full->tokens[$key];
-    if (!preg_match('/(path|alias|url|url-brief)(-raw)?$/', $token)) {
-      $replacements[$token] = pathauto_cleanstring($value);
-    }
-    elseif (preg_match('/(bookpath|menupath)(-raw)?$/', $token)) {
-      // A few tokens violate the path/path-raw naming convention and should
-      // still have their segments cleaned using pathauto_cleanstring().
-      $segments = explode('/', $value);
-      $segments = array_map('pathauto_cleanstring', $segments);
+    if (strpos($token, 'path') !== FALSE && is_array($value)) {
+      // If the token value is an array if we specified $options['pathauto'] = TRUE,
+      // then we should assume this is a 'segment' URL that should be pieced back
+      // together.
+      $segments = array_map('pathauto_cleanstring', $value);
       $replacements[$token] = implode('/', $segments);
     }
+    elseif (!preg_match('/(path|alias|url|url-brief)(-raw)?$/', $token)) {
+      // Tokens that do not match URL-type names should still have their values
+      // cleaned.
+      $replacements[$token] = pathauto_cleanstring($value);
+    }
     else {
+      // The token must be an URL or alias token that should not be left raw.
       $replacements[$token] = $value;
     }
   }
Index: pathauto.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.test,v
retrieving revision 1.1.4.28
diff -u -p -r1.1.4.28 pathauto.test
--- pathauto.test	11 Aug 2010 19:30:27 -0000	1.1.4.28
+++ pathauto.test	23 Sep 2010 15:30:10 -0000
@@ -32,8 +32,8 @@ class PathautoTestHelper extends DrupalW
   }
 
   function assertToken($type, $object, $token, $expected) {
-    $tokens = pathauto_token_values($type, $object);
-    $this->assertEqual($tokens[$token], $expected, t("Token value for [@token] was '!actual', expected value '!expected'.", array('@token' => $token, '!actual' => $tokens[$token], '!expected' => $expected)));
+    $tokens = pathauto_get_placeholders($type, $object);
+    $this->assertEqual($tokens['values'][$token], $expected, t("Token value for [@token] was '!actual', expected value '!expected'.", array('@token' => $token, '!actual' => $tokens['values'][$token], '!expected' => $expected)));
   }
 
   function saveAlias($source, $alias, $language = '') {
Index: pathauto.tokens.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/Attic/pathauto.tokens.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 pathauto.tokens.inc
--- pathauto.tokens.inc	11 Aug 2010 19:30:27 -0000	1.1.2.10
+++ pathauto.tokens.inc	23 Sep 2010 15:30:11 -0000
@@ -83,16 +83,14 @@ function _pathauto_token_values($type, $
 
       // Tokens [catpath] and [catpath-raw].
       if (isset($object->tid)) {
-        module_load_include('inc', 'pathauto');
         $parents = taxonomy_get_parents_all($object->tid);
         $catpath = $catpath_raw = array();
         foreach ($parents as $parent) {
-          $term_name_cleaned = pathauto_cleanstring($parent->name);
-          array_unshift($catpath, check_plain($term_name_cleaned));
-          array_unshift($catpath_raw, $term_name_cleaned);
+          array_unshift($catpath, check_plain($parent->name));
+          array_unshift($catpath_raw, $parent->name);
         }
-        $values[$label . 'path'] = implode('/', $catpath);
-        $values[$label . 'path-raw'] = implode('/', $catpath_raw);
+        $values[$label . 'path'] = !empty($options['pathauto']) ? $catpath : implode('/', $catpath);
+        $values[$label . 'path-raw'] = !empty($options['pathauto']) ? $catpath_raw : implode('/', $catpath_raw);
 
         // Token [catalias-raw] and [catalias].
         $values[$label . 'alias-raw'] = drupal_get_path_alias(taxonomy_term_path($object));
