[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Mpaa mpaa.w...@gmail.com changed:

   What|Removed |Added

 CC||mpaa.w...@gmail.com

--- Comment #6 from Mpaa mpaa.w...@gmail.com ---
The type of warning is decoded into the exception message as follows:
upload_warnings = {
# map API warning codes to user error messages
# %(msg)s will be replaced by message string from API responsse
'duplicate-archive': The file is a duplicate of a deleted file
%(msg)s.,
'was-deleted': The file %(msg)s was previously deleted.,
'emptyfile': File %(msg)s is empty.,
'exists': File %(msg)s already exists.,
'duplicate': Uploaded file is a duplicate of %(msg)s.,
'badfilename': Target filename is invalid.,
'filetype-unwanted-type': File %(msg)s type is unwanted type.,
}

So from the message, in a way, it is possile to understand the kind of warning.
If this is not clean enough, it can be improved further.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #7 from Jesús Martínez Novo (Ciencia Al Poder) 
martinezn...@gmail.com ---
Parsing a text is not very clean IMHO :)

I was expecting UploadWarning to have a property that will return the error key
from the api (the key values from upload_warnings), that would be a good way to
handle this

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Fabian commodorefabia...@gmx.de changed:

   What|Removed |Added

 CC||commodorefabia...@gmx.de

--- Comment #8 from Fabian commodorefabia...@gmx.de ---
I would suggest to add a code to the UploadWarning which uses the keys of the
upload_warnings dictionary.

So you could do something like:

try:
site.upload(…)
except UploadWarning as e:
if e.code == 'exists':
# do stuff here: the file already exists

It's still 'parsing a text' but far easier, but maybe somebody has a better
idea.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #9 from Jesús Martínez Novo (Ciencia Al Poder) 
martinezn...@gmail.com ---
Yes, that's what I was thinking. Maybe if I feel comfortable understanding how
to do that I'll do that someday...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #10 from Fabian commodorefabia...@gmx.de ---
No worries, I'm currently working on a patch where you could simply parse the
code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #12 from Gerrit Notification Bot gerritad...@wikimedia.org ---
Change 155739 merged by jenkins-bot:
[FEAT] UploadWarning uses the warning code

https://gerrit.wikimedia.org/r/155739

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Mpaa mpaa.w...@gmail.com changed:

   What|Removed |Added

 Status|PATCH_TO_REVIEW |RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-22 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Jesús Martínez Novo (Ciencia Al Poder) martinezn...@gmail.com changed:

   What|Removed |Added

   Assignee|martinezn...@gmail.com  |commodorefabia...@gmx.de

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Gerrit Notification Bot gerritad...@wikimedia.org changed:

   What|Removed |Added

 Status|NEW |PATCH_TO_REVIEW

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #1 from Gerrit Notification Bot gerritad...@wikimedia.org ---
Change 155560 had a related patch set uploaded by Martineznovo:
upload.py: Add option to automatically abort upload on warning

https://gerrit.wikimedia.org/r/155560

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

Jesús Martínez Novo (Ciencia Al Poder) martinezn...@gmail.com changed:

   What|Removed |Added

   Assignee|pywikipedia-b...@lists.wiki |martinezn...@gmail.com
   |media.org   |

--- Comment #2 from Jesús Martínez Novo (Ciencia Al Poder) 
martinezn...@gmail.com ---
Well, gerrit change 155560 is not exactly for warnings about existing files,
but for any warning. This usually would do the trick. It's currently not
possible to distinguish between different warnings without changing more things
in site.py

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

John Mark Vandenberg jay...@gmail.com changed:

   What|Removed |Added

   Priority|Unprioritized   |High
 CC||jay...@gmail.com

--- Comment #3 from John Mark Vandenberg jay...@gmail.com ---
It shouldnt be too difficult for api.pysite.py to provide upload.py with the
exact warning received by the MW API.

Is this fix urgent?  Do you have a project that needs this checked in promptly,
or can we work on trying to ignore only specific warnings?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #4 from Jesús Martínez Novo (Ciencia Al Poder) 
martinezn...@gmail.com ---
Well, I did that change to my code to bypass this limitation, and it worked
very well, that's why I shared my code pushing the change to gerrit, so for me
the issue is already solved :)

I'm not really fluent with python, since I've never worked before with it. I
just know a bit of its syntax and changed the code to make it work, looking at
how other parameters work. It could be improved to get the type of warning in
the UploadWarning class, but I don't know if I'll be able to do that, so feel
free to create a new patch solving this issue if you like

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l


[Bug 69852] upload.py: Add an option to automatically abort uploads if the file already exists

2014-08-21 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69852

--- Comment #5 from Gerrit Notification Bot gerritad...@wikimedia.org ---
Change 155560 merged by jenkins-bot:
upload.py: Add option to automatically abort upload on warning

https://gerrit.wikimedia.org/r/155560

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l