[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pywikipediabot-users
Subject:    [Pywikipedia-l] SVN: [6105] branches/rewrite/pywikibot/textlib.py
From:       russblau () mayflower ! knams ! wikimedia ! org
Date:       2008-11-17 20:18:33
Message-ID: E1L2AYL-0004XK-9P () lily ! knams ! wikimedia ! org
[Download RAW message or body]

Revision: 6105
Author:   russblau
Date:     2008-11-17 20:18:33 +0000 (Mon, 17 Nov 2008)

Log Message:
-----------
fix treatment of positional parameters to match MediaWiki's

Modified Paths:
--------------
    branches/rewrite/pywikibot/textlib.py

Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py	2008-11-17 19:48:45 UTC (rev 6104)
+++ branches/rewrite/pywikibot/textlib.py	2008-11-17 20:18:33 UTC (rev 6105)
@@ -569,8 +569,11 @@
 
     Return value is a list of tuples. There is one tuple for each use of a
     template in the page, with the template title as the first entry and a
-    dict of parameters as the second entry.  Positional parameters are
-    indexed by an int, named parameters by a str.
+    dict of parameters as the second entry.  Parameters are indexed by
+    strings; as in MediaWiki, an unnamed parameter is given a parameter name
+    with an integer value corresponding to its position among the unnnamed
+    parameters, and if this results multiple parameters with the same name
+    only the last value provided will be returned.
 
     """
     # remove commented-out stuff etc.
@@ -653,7 +656,7 @@
                     if "=" in param:
                         param_name, param_val = param.split("=", 1)
                     else:
-                        param_name = numbered_param
+                        param_name = unicode(numbered_param)
                         param_val = param
                         numbered_param += 1
                     for m2 in Rmarker.finditer(param_val):



_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic