Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-02-01 Thread Brian Wolff
On Jan 31, 2014 9:59 PM, Tyler Romeo tylerro...@gmail.com wrote: On Fri, Jan 31, 2014 at 8:38 PM, Mark Holmquist mtrac...@member.fsf.org wrote: http://restpatterns.org/HTTP_Headers/If-Unmodified-Since It should be passed a value that matches a Last-Modified value that we get from the

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-31 Thread Mark Holmquist
On Wed, Jan 22, 2014 at 12:41:30PM +0100, Petr Bena wrote: 1) Retrieve the page - page must not be changed starts NOW 2) Do something what requires user input, possibly may last few minutes 3) Save the page ONLY if it wasn't changed, if it was, go back to step 1 The way we should *cough* do

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-31 Thread Tyler Romeo
On Fri, Jan 31, 2014 at 8:38 PM, Mark Holmquist mtrac...@member.fsf.orgwrote: http://restpatterns.org/HTTP_Headers/If-Unmodified-Since It should be passed a value that matches a Last-Modified value that we get from the previous fetch page contents API call. Unfortunately, MediaWiki refuses

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-25 Thread Liangent
On Thu, Jan 23, 2014 at 9:22 AM, Matthew Flaschen mflasc...@wikimedia.orgwrote: On 01/22/2014 12:35 PM, Petr Bena wrote: this explanation should be in the documentation ;) anyway I guess I need to use both of them? basetimestamp (the timestamp of the revision your edit is based on) should

[Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Petr Bena
The title pretty much say what I need 1) Retrieve the page - page must not be changed starts NOW 2) Do something what requires user input, possibly may last few minutes 3) Save the page ONLY if it wasn't changed, if it was, go back to step 1 this all needs to be done using API, I thought that

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Petr Bena
Just to make it clear: 1) Retrieve the page, store last edit time as TIME 2) Do something what requires user input, possibly may last few minutes 3) Retrieve the page history Possible race condition here, what if someone edit the page before step 3

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Brian Wolff
On Jan 22, 2014 7:41 AM, Petr Bena benap...@gmail.com wrote: The title pretty much say what I need 1) Retrieve the page - page must not be changed starts NOW 2) Do something what requires user input, possibly may last few minutes 3) Save the page ONLY if it wasn't changed, if it was, go back

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Petr Bena
In documentation I see: basetimestamp: Timestamp of the base revision (obtained through prop=revisionsrvprop=timestamp). Used to detect edit conflicts; leave unset to ignore conflicts starttimestamp: Timestamp when you obtained the edit token. Used to detect edit conflicts; leave unset to ignore

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Brian Wolff
The time you obtained the edit token has nothing to do with the uniqueness of the token, or the effective life time of the token. I believe starttimestamp is just any edit after this point is a conflict, where base timestamp should match the timestamp of the base revision. Thus the difference

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Brad Jorsch (Anomie)
On Wed, Jan 22, 2014 at 4:11 AM, Brian Wolff bawo...@gmail.com wrote: I believe starttimestamp is just any edit after this point is a conflict, where base timestamp should match the timestamp of the base revision. Thus the difference between them is you give them different values.

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Petr Bena
this explanation should be in the documentation ;) anyway I guess I need to use both of them? On Wed, Jan 22, 2014 at 8:22 PM, Brad Jorsch (Anomie) bjor...@wikimedia.org wrote: On Wed, Jan 22, 2014 at 4:11 AM, Brian Wolff bawo...@gmail.com wrote: I believe starttimestamp is just any edit

Re: [Wikitech-l] How to retrieve the page, execute some time expensive operation and edit the page ONLY if it wasn't changed meanwhile

2014-01-22 Thread Matthew Flaschen
On 01/22/2014 12:35 PM, Petr Bena wrote: this explanation should be in the documentation ;) anyway I guess I need to use both of them? basetimestamp (the timestamp of the revision your edit is based on) should be sufficient. I might be missing something, but I can't think of a scenario