https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
Web browser: --- Bug ID: 54553 Summary: Convert relative links to absolute links in linkedPages(). Product: Pywikibot Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
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().
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- patch at Sep 26 2012, 21:53:58
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #2 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- New patch has been uploaded.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #3 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- yes. Fixed in r11010.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #4 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Well, it should be self.site.family.namespacesWithSubpage rather than self.site.namespacesWithSubpage.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #5 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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'
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #6 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- is going wrong with "/../" and collections must be imported
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #7 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #8 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- I've done a patch in r10987. Please have a look at this. The right list for some mw projects will come soon.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #9 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #10 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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%5C). 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. :-)
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #11 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #12 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **status**: pending-fixed --> open-fixed
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #13 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **status**: open-fixed --> pending-fixed
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #14 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **status**: open --> open-fixed
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #15 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **assigned_to**: nobody --> xqt
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
--- Comment #16 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- 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.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/patches/589
https://bugzilla.wikimedia.org/show_bug.cgi?id=54553
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |info@gno.de Assignee|Pywikipedia-bugs@lists.wiki |info@gno.de |media.org |
pywikipedia-bugs@lists.wikimedia.org