Last modified: 2014-09-18 08:45:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56553, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54553 - Convert relative links to absolute links in linkedPages().
Convert relative links to absolute links in linkedPages().
Status: ASSIGNED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
compat-(1.0)
All All
: Unprioritized normal
: ---
Assigned To: xqt
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-24 22:30 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-18 08:45 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-09-24 22:30:23 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\(\).
Comment 1 Kunal Mehta (Legoktm) 2013-09-24 22:30:25 UTC
patch at Sep 26 2012, 21:53:58
Comment 2 Kunal Mehta (Legoktm) 2013-09-24 22:30:27 UTC
New patch has been uploaded.
Comment 3 Kunal Mehta (Legoktm) 2013-09-24 22:30:29 UTC
yes. Fixed in r11010.
Comment 4 Kunal Mehta (Legoktm) 2013-09-24 22:30:30 UTC
Well, it should be self.site.family.namespacesWithSubpage rather than self.site.namespacesWithSubpage.
Comment 5 Kunal Mehta (Legoktm) 2013-09-24 22:30:32 UTC
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'
Comment 6 Kunal Mehta (Legoktm) 2013-09-24 22:30:34 UTC
is going wrong with "/../" and collections must be imported
Comment 7 Kunal Mehta (Legoktm) 2013-09-24 22:30:36 UTC
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.
Comment 8 Kunal Mehta (Legoktm) 2013-09-24 22:30:37 UTC
I've done a patch in r10987. Please have a look at this. The right list for some mw projects will come soon.
Comment 9 Kunal Mehta (Legoktm) 2013-09-24 22:30:39 UTC
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
Comment 10 Kunal Mehta (Legoktm) 2013-09-24 22:30:41 UTC
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. :-\)
Comment 11 Kunal Mehta (Legoktm) 2013-09-24 22:30:43 UTC
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.
Comment 12 Kunal Mehta (Legoktm) 2013-09-24 22:30:44 UTC
- **status**: pending-fixed --> open-fixed
Comment 13 Kunal Mehta (Legoktm) 2013-09-24 22:30:46 UTC
- **status**: open-fixed --> pending-fixed
Comment 14 Kunal Mehta (Legoktm) 2013-09-24 22:30:48 UTC
- **status**: open --> open-fixed
Comment 15 Kunal Mehta (Legoktm) 2013-09-24 22:30:50 UTC
- **assigned_to**: nobody --> xqt
Comment 16 Kunal Mehta (Legoktm) 2013-09-24 22:30:52 UTC
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.
Comment 17 John Mark Vandenberg 2014-07-25 20:57:18 UTC
This appears to still be a problem; the patches were not checked in.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links