The following might be a bit unclear, as it's a bit of a brain dump. It's
mainly meant as a response to
https://gerrit.wikimedia.org/r/#/c/137904/2/tests/l10n_tests.py and
https://gerrit.wikimedia.org/r/#/c/137924/ and as 'food for thought'.
Basically, the question is how we can let the i18n not depend on the
hardcoded 'scripts.i18n' import - this is problematic for tests, is
problematic for pywikibot-installed-as-a-package (because there is no
scripts.i18n then) and is problematic for third party authors (because they
*have* to use the scripts.i18n folder to store their translations). I have
some thoughts on this, and maybe we can make something cool out of it.
Essentially, we would want a script to be able to indicate /where/ it's
i18n file is located. There's a few ways to do this, but I guess the
cleanest option is something like this:
- pywikibot.i18n gets an 'I18N' class which contains the current
twtranslate functions,
- this I18N class takes a parameter: the filename of the i18n translation
file (which, at some point, could also be a JSON file)
- maybe more filenames, if more translation files need to be loaded?
- or maybe a directory that contains translation files?
- we add a simple wrapper that would allow the current scripts to do
something like
import pywikibot.i18n
i18n = pywikibot.i18n.forScript(__file__)
where 'forScript' does some path parsing to change __file__ (= the filename
of the current file) from /path/to/original/file to
/path/to/original/i18n/file
which is the setup we are currently using.
I'm not sure about backwards compatibility, but I guess we could have a
pre-prepared pywikibot.i18n.twtranslate doing what it does now, via the
I18N class (listing all files, maybe?)
Please let me know if this sounds like a good idea to implement.
Merlijn
In https://gerrit.wikimedia.org/r/#/c/139792
I noticed that Page.delete() and page.protect() have a lot of user
interaction logic which would normally be in a script. e.g. asking a
user what actions to take. Also, they set a flag in the site object.
i.e. site._noDeletePrompt = True and site._noProtectPrompt = True
Is there any reason for it being in Page?
--
John Vandenberg
Betreff: Aw: Re: [Pywikipedia-l] drop support for python 2.6
> Currently user-agent _is_ included (by pywikibot/comms/http.py)
>
> xqt
>
Ah, no! Its the framework release, not the py version.
Sorry disturbing you
xqt
I still can't find a way to query only some item properties (e.g.
claims) from the Wikibase API using pywikibot.
I've tried all of them:
.get('claims')
.get(True, 'claims')
.get(force=True, 'claims')
.get('claims', force=True)
.get('claims', True)
but without success.
Bots often don't need all of the items' data, so such feature should be
implemented (or, if present, documented better!)
PS: is it worth to implement the 'wbgetclaims' action in our framework?
We have four sets of cleartext passwords (http & proxy & db), and secrets
such as various API keys and mw cookies and edit tokens.
The passwords are stored in two files in clear text (user-config.py and.
passwd). Other secrets are in cached api files, etc.
I would like to introduce an optional dependency on a library to manage
(some of?) these secrets. The current secret storage would continue to work
correctly.
The keyring package is the obvious candidate. Any objections or
improvements on that?
--
John Vandenberg
-------- Original message --------
From: John Mark Vandenberg <jayvdb(a)gmail.com>
Date: 15/06/2014 08:19 (GMT+00:00)
To: Pywikipedia discussion list <pywikipedia-l(a)lists.wikimedia.org>
Subject: [Pywikipedia-l] Secret management
We have four sets of cleartext passwords (http & proxy & db), and secrets such as various API keys and mw cookies and edit tokens.
The passwords are stored in two files in clear text (user-config.py and. passwd). Other secrets are in cached api files, etc.
I would like to introduce an optional dependency on a library to manage (some of?) these secrets. The current secret storage would continue to work correctly.
The keyring package is the obvious candidate. Any objections or improvements on that?
--
John Vandenberg
The i18n dict file must be committed first and you have to update submodules before your script works well. For your working copy you may c&p the dict file into the scripts/i18n folder for testing purposes.
Greetings
xqt
----- Ursprüngliche Nachricht -----
Von: Travis Briggs
Gesendet: 12.06.2014 19:30
An: Pywikibot discussion list
Betreff: Re: [Pywikipedia-l] (core) Adding code in scripts/i18n to gerritreview
Okay, so my follow up question is about this line:
comment = i18n.twtranslate(pywikibot.Site(), "selflink-remove")
Will that somehow work properly before the scripts/i18n code is submitted? Or do I have to submit the i18n code first and then make the core scripts change?
Thanks!
-Travis
On 12 June 2014 09:22, <info(a)gno.de> wrote:
----- Original Nachricht ----
Von: Travis Briggs <audiodude(a)gmail.com>
An: pywikipedia-l(a)lists.wikimedia.org
Datum: 12.06.2014 02:41
Betreff: [Pywikipedia-l] (core) Adding code in scripts/i18n to gerrit review
> Hi,
>
> I've sent my first patch for code review (
> https://gerrit.wikimedia.org/r/#/c/138661/)
>
> As part of the review, it was noted that I should move a 'msg' variable
> into scripts/i18n. I have done so, however now I'm wondering what the
> review process for code in that submodule?
>
> Is there a way to add my i18n code to the same gerrit review? Conceptually
> it is one change, though I'm not sure if maybe the way the i18n works is
> that the script can function with the corresponding i18n script missing. Is
> that possible?
>
> Thanks,
> -Travis
>
>
You can't. You must not use scripts/i18n directly but you have to commit the messages dict to pywikibot-i18n repository
Greetings
xqt
_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi,
I've sent my first patch for code review (
https://gerrit.wikimedia.org/r/#/c/138661/)
As part of the review, it was noted that I should move a 'msg' variable
into scripts/i18n. I have done so, however now I'm wondering what the
review process for code in that submodule?
Is there a way to add my i18n code to the same gerrit review? Conceptually
it is one change, though I'm not sure if maybe the way the i18n works is
that the script can function with the corresponding i18n script missing. Is
that possible?
Thanks,
-Travis