Revision: 43470
Author:   tstarling
Date:     2008-11-14 00:30:34 +0000 (Fri, 14 Nov 2008)

Log Message:
-----------
Don't use getParameter() inside substituteResultWithError(), since it will try 
to call dieUsage() again if the format parameter is invalid. This fixes the 
error message for invalid formats, which was broken.

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiFormatBase.php
    trunk/phase3/includes/api/ApiMain.php

Modified: trunk/phase3/includes/api/ApiFormatBase.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatBase.php 2008-11-14 00:28:21 UTC (rev 
43469)
+++ trunk/phase3/includes/api/ApiFormatBase.php 2008-11-14 00:30:34 UTC (rev 
43470)
@@ -70,6 +70,13 @@
        }
 
        /**
+        * Get the internal format name
+        */
+       public function getFormat() {
+               return $this->mFormat;
+       }
+
+       /**
         * Specify whether or not ampersands should be escaped to '&' when 
rendering. This
         * should only be set to true for the help message when rendered in the 
default (xmlfm)
         * format. This is a temporary special-case fix that should be removed 
once the help

Modified: trunk/phase3/includes/api/ApiMain.php
===================================================================
--- trunk/phase3/includes/api/ApiMain.php       2008-11-14 00:28:21 UTC (rev 
43469)
+++ trunk/phase3/includes/api/ApiMain.php       2008-11-14 00:30:34 UTC (rev 
43470)
@@ -445,7 +445,7 @@
                 * tell the printer not to escape ampersands so that our links 
do
                 * not break. */
                $printer->setUnescapeAmps ( ( $this->mAction == 'help' || 
$isError )
-                               && $this->getParameter('format') == 
ApiMain::API_DEFAULT_FORMAT );
+                               && $printer->getFormat() == 'XML' && 
$printer->getIsHtml() );
 
                $printer->initPrinter($isError);
 



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to