Menu

#1244 templatesWithParam return params in wrong order

closed-fixed
rewrite (44)
5
2010-10-05
2010-10-02
No

When there are more than 9 parameters in a template, templatesWithParam does not retuen them in the correct order. Below is a patch that fixes the problem:

### Eclipse Workspace Patch 1.0
#P pywikibot
Index: pywikibot/page.py
===================================================================
--- pywikibot/page.py (revision 8601)
+++ pywikibot/page.py (working copy)
@@ -930,13 +930,16 @@
args = template[1]
positional = []
named = {}
+ intkeys = {}
for key in sorted(args):
try:
int(key)
except ValueError:
named[key] = args[key]
else:
- positional.append(args[key])
+ intkeys[int(key)]=args[key]
+ for key in sorted(intkeys, key=int):
+ positional.append(intkeys[key])
for name in named:
positional.append("%s=%s" % (name, named[name]))
result.append((pywikibot.Page(link, self.site), positional))

Discussion

  • Russell Blau

    Russell Blau - 2010-10-05
    • status: open --> closed-fixed
     
  • Russell Blau

    Russell Blau - 2010-10-05

    Fixed in r8610

     

Log in to post a comment.