Re: [Wikitech-l] File upload file in HTMLForm with ooui

2018-04-17 Thread Toni Hermoso Pulido

El 04/16/2018 a les 05:14 PM, Gergo Tisza ha escrit:


On Mon, Apr 16, 2018 at 12:40 AM, Brian Wolff  wrote:


So basically no, its not possible currently without implementing your own
HTMLFormField subclass.


The task for that is https://phabricator.wikimedia.org/T170263
Should be pretty easy, the OOUI widget exists already.



Thank you both for do some research about and also pointing this task!

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] File upload file in HTMLForm with ooui

2018-04-15 Thread Toni Hermoso Pulido

Hi Brian,

if I only specify one I get this exception:

...

Descriptor with no class for fileupload: Array
(
[section] => upload
[label] => Upload file
[type] => file
[class] =>
)

...

Not using ooui, both are needed and it works...


On 15/04/2018 19:40, Brian Wolff wrote:

Im not sure, but having the class specified as HTMLTextField looks wrong
(type & class are mutually exclusive. You should only specify one).

--
Brian

On Sunday, April 15, 2018, Toni Hermoso Pulido <toni...@cau.cat> wrote:

Hello,

I'm trying to migrate a HTMLForm to use ooui

by following https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki

htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, 'myform' );

I noticed that a file upload form field that I had defined is not

rendered correctly when using ooui.

 'fileupload' => array(
 'section' => 'upload',
 'label' => 'Upload file',
 'class' => 'HTMLTextField',
 'type' => 'file'
 ),

This is shown as a text field but not as a file upload, as I would have

expected...


Is there any way to handle this and using OOUI at the same time?

Thanks!


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] File upload file in HTMLForm with ooui

2018-04-15 Thread Toni Hermoso Pulido

Hello,

I'm trying to migrate a HTMLForm to use ooui

by following https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki

htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, 'myform' );

I noticed that a file upload form field that I had defined is not 
rendered correctly when using ooui.


'fileupload' => array(
'section' => 'upload',
'label' => 'Upload file',
'class' => 'HTMLTextField',
'type' => 'file'
),

This is shown as a text field but not as a file upload, as I would have 
expected...



Is there any way to handle this and using OOUI at the same time?

Thanks!


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] LAST REMINDER: Wikimedia Hackathon 2018 Barcelona - 14 March

2018-03-08 Thread Toni Hermoso Pulido
Hello everyone,


We are getting close to maximum capacity for the Wikimedia Hackathon in
Barcelona. This is the last week that we will be accepting registrations
from anyone needing accommodation support (registration is already
closed for Wikimedia Foundation staff and those requesting scholarships).

The deadline for any additional registrations is Wednesday, 14 March.

https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018/Register_and_Attend


Please do not hesitate to mail hackat...@wikimedia.cat for any question!




___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] REMINDER: Wikimedia Hackathon 2018 Barcelona

2018-01-28 Thread Toni Hermoso Pulido
Dear all,

just a quick reminder, in a couple of days scholarship form is going to
be closed. So, if you planned to apply for a scholarship and you didn't
do, don't forget to do it the sooner the better.

https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018/Register_and_Attend

Moreover, participants from countries needing a VISA ( detail:
https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018/Travel ), do not
wait too long to register so we can fully help you in the process.

Looking forward to seeing you in Barcelona!

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Wikimedia Hackathon 2018, Barcelona: Registration Open

2018-01-03 Thread Toni Hermoso Pulido

Dear Wikimedians,

Registration and scholarship applications for the Wikimedia Hackathon 
2018 are open!

The hackathon will be taking place in Barcelona between 18 – 20 May 2018.

Scholarship applications are open until January 30, 2018.

- Register here:
https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018/Register_and_Attend
- Event details here:
https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018

Depending on your case and situation (e.g., applying for scholarship), 
you might need to fill more than one form, please read carefully.


Do not hesitate to forward this announcement along to any relevant 
mailing lists!


Looking forward to seeing you in Barcelona!


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Prehackathon Olot, 2-4 Feb 2018

2017-12-17 Thread Toni Hermoso Pulido
Dear Wikimedians,

as you likely know, upcoming Wikimedia Hackathon will take place in
Barcelona from 18 to 20 May 2018*.

https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018

Before that event, some previous activities are being organized, among
them a one-weekend Prehackathon in Olot (Catalonia) from 2 to 4 February
2018 focused on multilingualism and language technical aspects.

More details at:

https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2018/Prehackathon_Olot

Best,

Toni Hermoso

--

* Registration and scholarship details of May Hackathon will be public
in a few weeks.

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] RESTBase multiple pages with one request

2016-08-07 Thread Toni Hermoso Pulido
Thanks Gabriel, Jaime. It worked OK and it seems to be as fast as you
commented!

El 04/08/16 a les 23:34, Gabriel Wicke ha escrit:
> Toni, we heavily use caching to speed up the REST API, so making individual
> requests is the fastest way to retrieve content. You can use parallelism to
> achieve your desired throughput, and with HTTP/2 all those parallel
> requests can even share a single TCP connection. The request limit for the
> API overall is 200 req/s, as documented in
> https://en.wikipedia.org/api/rest_v1/?doc.
> 
> Hope this helps,
> 
> Gabriel
> 
> On Thu, Aug 4, 2016 at 2:20 PM, Jaime Crespo <jcre...@wikimedia.org> wrote:
> 
>> Sorry, I am not sure 100%, if that is true, maybe creating a feature
>> request may help suggesting its implementation?
>>
>> On Thu, Aug 4, 2016 at 3:09 PM, Toni Hermoso Pulido <toni...@cau.cat>
>> wrote:
>>> Thanks Jaime, so it only works with Action (MediaWiki default) API so
>>> far, doesn't it?
>>>
>>> El 08/04/2016 a les 10:07 AM, Jaime Crespo ha escrit:
>>>> Hi, you can combine multiple pages with the "pipe" sign:
>>>>
>>>> Check:
>>>> <https://en.wikipedia.org/w/api.php?action=query=
>> revisions=content=jsonfm=Hillary_Clinton|Donald_Trump
>>>
>>>> (change 'jsonfm' for 'json' on a real request)
>>>> There is a limit on the number of pages depending on your account
>>>> rights, but it is very helpful to avoid round-trip latencies for us in
>>>> high-latency places.
>>>>
>>>>
>>>> On Thu, Aug 4, 2016 at 9:34 AM, Toni Hermoso Pulido <toni...@cau.cat>
>> wrote:
>>>>> Hello,
>>>>>
>>>>> is it already possible to retrieve data from different pages just by
>>>>> using one request?
>>>>>
>>>>> E.g by combining:
>>>>> https://en.wikipedia.org/api/rest_v1/page/summary/Electron
>>>>> and
>>>>> https://en.wikipedia.org/api/rest_v1/page/summary/Dog


-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] RESTBase multiple pages with one request

2016-08-04 Thread Toni Hermoso Pulido
Thanks Jaime, so it only works with Action (MediaWiki default) API so
far, doesn't it?

El 08/04/2016 a les 10:07 AM, Jaime Crespo ha escrit:
> Hi, you can combine multiple pages with the "pipe" sign:
>
> Check:
> <https://en.wikipedia.org/w/api.php?action=query=revisions=content=jsonfm=Hillary_Clinton|Donald_Trump>
> (change 'jsonfm' for 'json' on a real request)
> There is a limit on the number of pages depending on your account
> rights, but it is very helpful to avoid round-trip latencies for us in
> high-latency places.
>
>
> On Thu, Aug 4, 2016 at 9:34 AM, Toni Hermoso Pulido <toni...@cau.cat> wrote:
>> Hello,
>>
>> is it already possible to retrieve data from different pages just by
>> using one request?
>>
>> E.g by combining:
>> https://en.wikipedia.org/api/rest_v1/page/summary/Electron
>> and
>> https://en.wikipedia.org/api/rest_v1/page/summary/Dog
>>
>>

-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc 


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] RESTBase multiple pages with one request

2016-08-04 Thread Toni Hermoso Pulido
Hello,

is it already possible to retrieve data from different pages just by
using one request?

E.g by combining:
https://en.wikipedia.org/api/rest_v1/page/summary/Electron
and
https://en.wikipedia.org/api/rest_v1/page/summary/Dog

Thanks!

-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] RESTBase JSONP output

2016-08-02 Thread Toni Hermoso Pulido
El 02/08/16 a les 21:34, bawolff ha escrit:
> On Tue, Aug 2, 2016 at 7:32 PM, Toni Hermoso Pulido <toni...@cau.cat> wrote:
>> Hello,
>>
>> I'm trying to include some output from
>> https://wikimedia.org/api/rest_v1/?doc into a Wikipedia
>> (xy.wikipedia.org) via a Javascript AJAX call.
>>
>> Is it possible to have a JSONP output? I have not found any
>> documentation so far. Otherwise, would there be any other way (avoiding
>> a backend part, of course)?
>>
>> Thanks,
>>
>> --
>> Toni Hermoso Pulido
>> http://www.cau.cat
>> http://www.similis.cc
>>
>> ___
>> Wikitech-l mailing list
>> Wikitech-l@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> 
> JSONP in general tends to be flaky. I strongly suggest you use CORS to
> access apis, even for the APIs that have JSONP available.
> 

Thanks Brian,

it works nice!


-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] RESTBase JSONP output

2016-08-02 Thread Toni Hermoso Pulido
Hello,

I'm trying to include some output from
https://wikimedia.org/api/rest_v1/?doc into a Wikipedia
(xy.wikipedia.org) via a Javascript AJAX call.

Is it possible to have a JSONP output? I have not found any
documentation so far. Otherwise, would there be any other way (avoiding
a backend part, of course)?

Thanks,

-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Disable validation in HTMLform

2015-05-07 Thread Toni Hermoso Pulido
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hello,

In an HTMLForm I'm filling a select with options extracted from a JSON
call (using ResourceLoader addModules).
Everything OK, excepts when I try to submit the form. The form is not
properly validated before even when I put 'validation-callback' =
true and required = false in the actual select I'm filling with
Javascript.

I presume this may be happening because I'm puting these options not
in the expected way.

How could this be solved? E. g., fully disabling validation of the form?

Involved code:
http://pastebin.com/Q5KA2e1U

Any idea? Thanks!

- -- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCAAGBQJVSyAdAAoJELt+jnuNHMW+c7MP/3Wztb2T5n3fiVzVlsmD38c1
VSJc3/HLwRtQQVDBTk7U0wrqie3/s6wsBNZUds63HqiEi+YE/PaWu/oqmyziiqr5
JNeIiPdfsWYoZFJhb5Y6mTVYWrEpn2QgtGkjeItvBc5QGjCRdJEOtASoqvmbSieT
mdNY30IolO8p6P4ILwoRhK/520+EIVm7YY4L12SdcPXGSQ+g1tFcZVut6uMjbfeD
KPA2X0mSiusIqxLAlhpl5ZbfUCOSj202MU928rWMqQe9A73Lfi/LURXeebDyLKTm
29uoLZ/K4SQ+1FQ8blfZHyikjJi8geMZV9yqFV0K96ADQkC95WxbHHE4aNkl1lxa
k4OViYOeoPekriNA/1DGBOEV2oE7oW2i7jeJTDxmWbN5DmFH3zY5QOMEpUZkXXvW
FnQ6FU20AHEda2nnukamLIoc585aaUoX1hRP+ugQKpiVJIzQTOHONU0D/SW9whdO
IX+P1JBw8e38ngsj7TbEQrVfmAv+4p3OXdfUI/HdeBqs4Mv+f1SB8Gi8GxUrGsOd
ZsTL5NTCNmZo5d/tdAIOtSKZJAYfe75BceRNKNfcHKFLS2RB8BhFSA4s8Lfd85wE
D3KHurkatzT7maAkQ17ym+ryn1Vu8FSck5d/RtHCKVq1FKPw5p68ExqQEP9qbA+A
Ig/fLxolcoxV1ZzAi+Zt
=nneA
-END PGP SIGNATURE-

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Disable validation in HTMLform

2015-05-07 Thread Toni Hermoso Pulido
Hi Florian,

I get a laconic 'There are problems with some of your input.'

processInput function does exist.

If I replace
$htmlForm-show();
to:
$htmlForm-prepareForm()-displayForm( false );

I don't get any error message, but it does not reach processInput

If no JS messes up with select, that is, options are placed in the code
normally, it works.

So, I guess there is some JS validation going before submitting that
blocks the process.

Any idea how to handle this?

Pd.: Version MW 1.23.9

El 05/07/2015 a les 11:03 AM, florian.schmidt.wel...@t-online.de ha escrit:
 What is the error message? It seems you just copied an example code, so i 
 assume, that SpecialMyModule::processInput() doesn't exist?
 
 If you want to add the form without any input validation you could use:
 $htmlForm-prepareForm()-displayForm( false );
 
 But it would (maybe) make sense to use the built-in input validation :)
 
 Best,
 Florian
 
 Freundliche Grüße
 Florian Schmidt
 -Original-Nachricht-
 Betreff: [Wikitech-l] Disable validation in HTMLform
 Datum: Thu, 07 May 2015 10:20:41 +0200
 Von: Toni Hermoso Pulido toni...@cau.cat
 An: Wikimedia developers wikitech-l@lists.wikimedia.org
 
 Hello,
 
 In an HTMLForm I'm filling a select with options extracted from a JSON
 call (using ResourceLoader addModules).
 Everything OK, excepts when I try to submit the form. The form is not
 properly validated before even when I put 'validation-callback' =
 true and required = false in the actual select I'm filling with
 Javascript.
 
 I presume this may be happening because I'm puting these options not
 in the expected way.
 
 How could this be solved? E. g., fully disabling validation of the form?
 
 Involved code:
 http://pastebin.com/Q5KA2e1U
 


-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] AJAX mw.util.wikiscript with POST

2014-09-19 Thread Toni Hermoso Pulido
Finally I managed to do it.

Thanks for the good advices!

El 09/05/2014 a les 06:43 PM, Krinkle ha escrit:
 It couldn't be more simple I'm afraid. Replace get with post.
 
 Note that both of these are just shortcuts to the more advanced $.ajax
 method, so if the reduced set of options exposed in get() and post()
 isn't enough, just call ajax() directly.
 
 https://api.jquery.com/jQuery.get/
 https://api.jquery.com/jQuery.post/
 https://api.jquery.com/jQuery.ajax/
 
 — Krinkle
 
 PS: Please use the Promise interface, not the callback parameters. Don't
 forget to handle errors, either.
 
 PS2: While this will help you get the request over POST, the underlying
 subsystem you're communicating with (action=ajax) has been deprecated
 for many years now. Please rewrite these global functions in a more
 modular fashion by creating an API module.
 
 https://www.mediawiki.org/wiki/API:Main_page
 
 On 3 Sep 2014, at 17:42, Toni Hermoso Pulido toni...@cau.cat
 mailto:toni...@cau.cat wrote:
 
 Hello,

 for different custom extensions I've been doing something like this with
 GET:

 $.get( mw.util.wikiScript(), {
 format: 'json',
 action: 'ajax',
 rs: 'MyExt::MyFunction',
 rsargs: [param1, param2]
 }, function(data) {
 // console.log(data);
 });

 MyExt::MyFunction is in $wgAjaxExportList[].

 However, since now I have too much data for a URL (414 HTTP error) I'd
 prefer to use POST. So far I have not found a proper way to build it.
 Any idea or advice?



-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] AJAX mw.util.wikiscript with POST

2014-09-03 Thread Toni Hermoso Pulido
Hello,

for different custom extensions I've been doing something like this with
GET:

$.get( mw.util.wikiScript(), {
format: 'json',
action: 'ajax',
rs: 'MyExt::MyFunction',
rsargs: [param1, param2]
}, function(data) {
// console.log(data);
});

MyExt::MyFunction is in $wgAjaxExportList[].

However, since now I have too much data for a URL (414 HTTP error) I'd
prefer to use POST. So far I have not found a proper way to build it.
Any idea or advice?

Thanks!

-- 
Toni Hermoso Pulido
http://www.cau.cat
http://www.similis.cc

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Parsing templates into associative arrays or objects

2014-02-15 Thread Toni Hermoso Pulido

El 14/02/14 23:59, Gabriel Wicke ha escrit:

On 02/14/2014 04:00 AM, Toni Hermoso Pulido wrote:

Within an extension, is there a
specific method (via Parser class, for instance) or a more or less
direct way that could turn a template in a wikitext string into an
object or associative array.


If you need both the parameters (including nested templates) and the
rendered output, then one option is to use Parsoid for this by calling
the web service:
http://parsoid-lb.eqiad.wikimedia.org/
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Transclusion_content



Thanks Gabriel!
I'll take a look!

--
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Parsing templates into associative arrays or objects

2014-02-14 Thread Toni Hermoso Pulido
Hello,

sorry for the maybe naïve question. Within an extension, is there a
specific method (via Parser class, for instance) or a more or less
direct way that could turn a template in a wikitext string into an
object or associative array.
Let's say:
{{Example|Name=John|Last=Smith}}
into:
{
Example: {
   Name: John,
   Last: Smith
 }
}

Thanks,

-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] API edit call in a maintenance script

2013-12-11 Thread Toni Hermoso Pulido

El 10/12/13 00:33, Liangent ha escrit:


On Tue, Dec 10, 2013 at 7:13 AM, Toni Hermoso Pulido toni...@cau.cat
mailto:toni...@cau.cat wrote:

Hello,

I'm trying to perform an API edit call in a maintenance script using
this example in MW 1.19.9
http://www.mediawiki.org/wiki/__API:Calling_internally
http://www.mediawiki.org/wiki/API:Calling_internally


$user = User::newFromId( 1 ); // Using WikiSysiop
$page = WikiPage::newFromID( $id );
$titleText = $page-getTitle()-__getPrefixedText();

$text = ...;

global $wgRequest;

$req = new DerivativeRequest(
 $wgRequest,
 array(
 'action' = 'edit',
 'title' = $titleText,
 'text' = $text,
 'token' = $user-editToken(),
 ), true);

$api = new ApiMain( $req, true );

$api-execute();

However, I get this problem:
Unexpected non-MediaWiki exception encountered, of type UsageException
badtoken: Invalid token

Any idea what can be wrong?


Token is not used to do user lookup. You need to call
$api-getContext()-setUser( $user ); before $api-execute();.



Hello Liangent,

it does not seem to work. In the end, call seems to be performed as 
anonymous.


In any case, I would continue sticked to doEdit, as Max pointed out.

Thanks!

--
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] API edit call in a maintenance script

2013-12-09 Thread Toni Hermoso Pulido

Hello,

I'm trying to perform an API edit call in a maintenance script using 
this example in MW 1.19.9

http://www.mediawiki.org/wiki/API:Calling_internally


$user = User::newFromId( 1 ); // Using WikiSysiop
$page = WikiPage::newFromID( $id );
$titleText = $page-getTitle()-getPrefixedText();

$text = ...;

global $wgRequest;

$req = new DerivativeRequest(
$wgRequest,
array(
'action' = 'edit',
'title' = $titleText,
'text' = $text,
'token' = $user-editToken(),
), true);

$api = new ApiMain( $req, true );

$api-execute();

However, I get this problem:
Unexpected non-MediaWiki exception encountered, of type UsageException
badtoken: Invalid token

Any idea what can be wrong?

P.D.: I already use WikiPage::doEdit() successfully.

--
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Processing unknown named template parameters with Scribunto

2013-05-14 Thread Toni Hermoso Pulido
Hello,

yesterday I found myself with a problem similar to the one described here:
http://stackoverflow.com/questions/15164710/mediawiki-templates-inherit-parameters
But, actually, I would like to process template paramaters without first
having to return the values associated to them  - {{{param1}}},
{{{param2}}}. Let's say, something like processing argv, where argv may
contain argv['param1'], argv['param2'], but not knowing whether param1
or param2 do exist first (I should iterate over keys in this case…)

Is this something that might be done somehow by using Lula (Scribunto)?

Thanks!
-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Processing unknown named template parameters with Scribunto

2013-05-14 Thread Toni Hermoso Pulido
Hehe, thanks Paul for the nice example!

2013/5/14 Paul Selitskas p.selits...@gmail.com:
 Yes, Lula (lol :)) seems to fit your purpose well. Look here[1], it just
 works!

 ---
 [1] https://en.wikipedia.org/wiki/Template:Navbox


 On Tue, May 14, 2013 at 11:09 AM, Toni Hermoso Pulido toni...@cau.cat
 wrote:

 Hello,

 yesterday I found myself with a problem similar to the one described here:

 http://stackoverflow.com/questions/15164710/mediawiki-templates-inherit-parameters
 But, actually, I would like to process template paramaters without first
 having to return the values associated to them  - {{{param1}}},
 {{{param2}}}. Let's say, something like processing argv, where argv may
 contain argv['param1'], argv['param2'], but not knowing whether param1
 or param2 do exist first (I should iterate over keys in this case…)

 Is this something that might be done somehow by using Lula (Scribunto)?

 Thanks!
 --
 Toni Hermoso Pulido
 http://www.cau.cat

 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l




 --
 З павагай,
 Павел Селіцкас/Pavel Selitskas
 Wizardist @ Wikimedia projects



-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Processing unknown named template parameters with Scribunto

2013-05-14 Thread Toni Hermoso Pulido
By the way, I found this short guide
https://test2.wikipedia.org/wiki/Wikipedia:Guide_to_Scribbling (which
helped me to know how to get Parent frame args). Shouldn't it
somewhere else as well (unless I didn't manage to find it in other
wikis) ?

2013/5/14 Toni Hermoso Pulido toni...@cau.cat:
 Hehe, thanks Paul for the nice example!

 2013/5/14 Paul Selitskas p.selits...@gmail.com:
 Yes, Lula (lol :)) seems to fit your purpose well. Look here[1], it just
 works!

 ---
 [1] https://en.wikipedia.org/wiki/Template:Navbox


 On Tue, May 14, 2013 at 11:09 AM, Toni Hermoso Pulido toni...@cau.cat
 wrote:

 Hello,

 yesterday I found myself with a problem similar to the one described here:

 http://stackoverflow.com/questions/15164710/mediawiki-templates-inherit-parameters
 But, actually, I would like to process template paramaters without first
 having to return the values associated to them  - {{{param1}}},
 {{{param2}}}. Let's say, something like processing argv, where argv may
 contain argv['param1'], argv['param2'], but not knowing whether param1
 or param2 do exist first (I should iterate over keys in this case…)

 Is this something that might be done somehow by using Lula (Scribunto)?

 Thanks!
 --
 Toni Hermoso Pulido
 http://www.cau.cat

 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l




 --
 З павагай,
 Павел Селіцкас/Pavel Selitskas
 Wizardist @ Wikimedia projects



 --
 Toni Hermoso Pulido
 http://www.cau.cat



-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Detect running from maintenance script in a parser function extension

2013-03-12 Thread Toni Hermoso Pulido
Hello,

I'm checking whether I can detect that a process is run from a
maintenance script in a parser function extension.

Which would be the best way / more recommendable to detect it?

Thanks!
-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Detect running from maintenance script in a parser function extension

2013-03-12 Thread Toni Hermoso Pulido
Al 12/03/13 21:08, En/na Brian Wolff ha escrit:
 On 2013-03-12 3:19 PM, Tyler Romeo tylerro...@gmail.com wrote:

 On Tue, Mar 12, 2013 at 1:47 PM, Toni Hermoso Pulido toni...@cau.cat
 wrote:

 Hello,

 I'm checking whether I can detect that a process is run from a
 maintenance script in a parser function extension.

 Which would be the best way / more recommendable to detect it?

 Thanks!


 $wgCommandLineMode should be able to tell you, although I think checking
 if
 the RUN_MAINTENANCE_IF_MAIN constant is set is probably a better method.

 *--*
 *Tyler Romeo*
 Stevens Institute of Technology, Class of 2015
 Major in Computer Science
 www.whizkidztech.com | tylerro...@gmail.com
 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l
 
 More interesting question - why do you need to know.
 
 Making wikitext vary between maintenance script and normal may cause a bit
 of breakage given jobQueue etc.

Hello,

maybe it's a bit weird and little orthodox…
In any case, it's for batch processing (with WikiPage::doEdit) some wiki
pages that have a UserFunctions parserfunction in their wikitext
http://www.mediawiki.org/wiki/Extension:UserFunctions
so that such parser function is ignored in building the page.

Cheers,
-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Welcome Quim Gil to Engineering Community Team!

2012-11-14 Thread Toni Hermoso Pulido
Nice seeing you here!

Welcome and happy birthday!

2012/11/13 Sumana Harihareswara suma...@wikimedia.org:
 I am very happy to announce that tomorrow is Quim Gil's first day in the
 Engineering Community Team of the Wikimedia Foundation.  His title is
 Technical Contributor Coordinator (IT Communications Manager) which
 means that he'll be reaching out to and nurturing our testers, coders,
 documenters, product managers, sysadmins, and other contributors to
 Wikimedia technologies like MediaWiki.  His blog entry about coming to
 WMF: https://flors.wordpress.com/2012/08/27/moving-up-in-the-freedom-stack/

 Quim is a contributor to Catalan Wikisource  Wikipedia and English
 Wikipedia (User:Qgil), and has helped Wikimedia's mobile team as a
 volunteer.  Most recently he's dug into statistical analysis of
 MediaWiki's coder community and the philosophical conundrum of
 RESOLVED:LATER.  You might also know him from his activity in the worlds
 of GNOME, Qt, and Maemo -- he's coming to us from Nokia.  If I try to
 detail all the consulting, event-running, volunteer recruiting, open
 source community management, writing, and projects he's done, I'll hit
 some kind of mailman limit so I won't try. :-)

 Quim lives in the Bay Area and will be working out of the San Francisco
 office while reporting to me remotely, which is kind of hilarious.  In
 the near future he'll be encouraging volunteer testers and running our
 Outreach Program for Women.

 And tomorrow is Quim's birthday!  So, happy birthday and welcome, Quim!



-- 
Toni Hermoso Pulido
http://www.cau.cat

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l