Last modified: 2014-09-18 08:45:39 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/patches/589/ Reported by: nu11zer0 Created on: 2013-01-26 17:33:22 Subject: Convert relative links to absolute links in linkedPages(). Assigned to: xqt Original description: Convert relative links to absolute links in linkedPages\(\).
patch at Sep 26 2012, 21:53:58
New patch has been uploaded.
yes. Fixed in r11010.
Well, it should be self.site.family.namespacesWithSubpage rather than self.site.namespacesWithSubpage.
After this patch I get an error on any interwiki.py task: Traceback \(most recent call last\): File "U:\pywikipedia 4\interwiki.py", line 2589, in <module> main\(\) File "U:\pywikipedia 4\interwiki.py", line 2563, in main bot.run\(\) File "U:\pywikipedia 4\interwiki.py", line 2296, in run self.queryStep\(\) File "U:\pywikipedia 4\interwiki.py", line 2269, in queryStep self.oneQuery\(\) File "U:\pywikipedia 4\interwiki.py", line 2265, in oneQuery subject.batchLoaded\(self\) File "U:\pywikipedia 4\interwiki.py", line 1328, in batchLoaded \(skip, alternativePage\) = self.disambigMismatch\(page, counter\) File "U:\pywikipedia 4\interwiki.py", line 1092, in disambigMismatch if self.originPage.isDisambig\(\) and not page.isDisambig\(\): File "U:\pywikipedia 4\wikipedia.py", line 1529, in isDisambig for link in disambigpages.linkedPages\(\) File "U:\pywikipedia 4\wikipedia.py", line 2720, in linkedPages if self.namespace\(\) in self.site\(\).namespacesWithSubpage: AttributeError: 'Site' object has no attribute 'namespacesWithSubpage'
is going wrong with "/../" and collections must be imported
Thank you very much. However, r10987 can't deal with the link \[\[../../\]\]. I have uploaded a new version that can handle this case. Please reply to me if you have any doubt.
I've done a patch in r10987. Please have a look at this. The right list for some mw projects will come soon.
What is with the article namespace on other projects than "wikipedia"? What about several other namespaces? At the moment not all wikipedia sister projects have subpages on project: and help: namespaces
I should have explained the patch clearer. Sorry. Relative link is disabled on main namespace of Wikipedia because subpage feature is disabled there \(See http://en.wikipedia.org/wiki/Wikipedia:Subpages\). For example, on main namespace of Wikipedia, if you write \[\[/b\]\] on page "a", it will produce a link to page "/b". However, if you do the same thing on another namespace or another family, it will produce a link to \[\[a/b\]\]. I just write the code to simulate this behavior as much as possible. For os.path problem, I will fix it soon. Thank you for noticing this problem much. :-\)
In general a good idea but could you please explain that patch? What is the reason to do that fix outside the wikipedia article namespace only? \{the condition is equal to: not \(self.site.family.name == "wikipedia" and self.namespace\(\) == 0\)\} And btw os.path methods does not work for mediawiki "directories" especial with windows os.
- **status**: pending-fixed --> open-fixed
- **status**: open-fixed --> pending-fixed
- **status**: open --> open-fixed
- **assigned_to**: nobody --> xqt
I upload a somewhat more concise version. I started this on my own before I found out about u/nu11zer0's original post, although I adopted some of their ideas. Note that a relative link always starts with '/' or a series of '../', everything else is a legitimate absolute link or not a link.
This appears to still be a problem; the patches were not checked in.