-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Just to finish this topic, I've created a function:
dblink2wikilink(site, dblink) which takes a (any available) site object and the link text given with dblink syntax and returns the according interwiki link (still as text). This interwiki link can then be used with the page object. Feel free to use or put the code upstream, as you like; it is given in r165: https://fisheye.toolserver.org/changelog/drtrigon?cs=165 Thanks for the support and Greetings DrTrigon Am 31.08.2011 10:28, schrieb Dr. Trigon: > Hello xqt! > > First thanks - and sorry for re-raising the issue! I'm aware that > you tried to explain me - in fact you did well, but still I was > able to confuse myself again... ;) (may be since ID: 3084721 was > still open) > > Site.dbName() is very simple since it just returns '%swiki_p' % > code (for historic reasons ;). As you correct statet I need a > 'dbname2wikilink()' conversion, which I try to do in a most general > way. And as you said I am using a (dirty and bad) side effect. Now > thats the point - is there really no other correct way of doing it > (beside text modification with 'replace' - which is essantially > what I am doing now)? What about loading all families to call their > 'dbName()' member? Somehow brute force... isn't it? :) > > So since we (finally ;) can agree to PEP20 (The Zen of Python) I > would like to write such a 'dbname2wikilink()' and this without > breaking the rules. So where to place? 'wikipedia.Site', 'textlib', > ...? And what method to use? Modification with 'replace', > 'family.dbName', ...? (Hopefully you are Dutch and can give me some > hints...? ;)) > > Thanks a lot for your patience (and good memory! ;)) Greetings > Dr.Trigon > > > Am 30.08.2011 22:50, schrieb [email protected]: >> Hi DrTrigon, > >> "wiki" is reserved by Family.known_families. You know you get >> the related dbName of a site just by Site.dbName() which returns >> "dewiki_p" for "wikipedia:de". Thereby for historic reasons, the >> databases are called xxwiki instead of xxwikipedia for >> Wikipedias. > >> You are using side effects doing your dbname2wikilink() >> conversion and I am sure you are able to modificate this stuff >> with stuff.replace("wiki:", "wikipedia:") if needed. In other >> words (your wrote me) "There should be one-- and preferably only >> one --__obvious__ way to do it" and btw "Although that way may >> not be obvious at first unless you're Dutch" (again: PEP20, The >> Zen of Python) > >> Sali ;) > >> xqt > > >> ----- Original Nachricht ---- Von: "Dr. Trigon" >> <[email protected]> An: [email protected] >> Datum: 30.08.2011 19:02 Betreff: Re: [Pywikipedia-l] 'wiki' >> as synonym for 'wikipedia' in family? > >>>>> "wiki" is being use as the interwiki link to the original >>>>> wiki, WikiWikiWeb at http://c2.com/cgi/wiki, so you >>>>> shouldn't use that for anything related to Wikipedia. You >>>>> are getting it returned since Wikipedias can use it as an >>>>> interwiki link to the WikiWikiWeb, i.e. >>>>> [[:wiki:WelcomeVisitors]] becomes >>>>> http://c2.com/cgi/wiki?WelcomeVisitors > >> So this means essentially 'wiki' in toolserver DB (like e.g. >> 'dewiki') does not refer to the same as 'wiki' in pywikipediabot >> and interwiki... (strange...) > >> But would also explain this 'inconsistency'... ;) > >> Thanks and Greetings >>> >>> _______________________________________________ Pywikipedia-l >>> mailing list [email protected] >>> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l >>> > >> _______________________________________________ Pywikipedia-l >> mailing list [email protected] >> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l > > > > _______________________________________________ Pywikipedia-l > mailing list [email protected] > https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5fR7sACgkQAXWvBxzBrDAy3ACfe4M5nE9fQtxK7GevIesnmB3/ ZTEAn18i5ZWgdTt9+FBczP0Vuhq1c6ls =6ho+ -----END PGP SIGNATURE----- _______________________________________________ Pywikipedia-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
