DD063520 added a comment.

  The difference is the following .... if you try to put in the wiki twice the 
same property:
  
    wikibase_property =  pywikibot.PropertyPage(wikibase_repo, "P100", 
datatype='wikibase-item')
    wikibase_property.get()
    wikibase_property.editLabels(labels={'en': 'test123'}, summary='Setting 
labels')
    
    wikibase_property =  pywikibot.PropertyPage(wikibase_repo, "P101", 
datatype='wikibase-item')
    wikibase_property.get()
    wikibase_property.editLabels(labels={'en': 'test123'}, summary='Setting 
labels')
  
  in the new case:
  
    messages = None
    if 'messages' in error:
                messages = error['messages']
  
  the error contains the following information:
  
  failed-save: The save has failed. [messages:[{'name': 
'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has 
failed.'}}, {'name': 'wikibase-validator-label-conflict', 'parameters': 
['test123', 'en', '[[Property:P100 
<https://phabricator.wikimedia.org/P100>|P100 
<https://phabricator.wikimedia.org/P100>]]'], 'html': {'*': 'Property <a 
href="/wiki/Property:P100 <https://phabricator.wikimedia.org/P100>" 
title="Property:P100 <https://phabricator.wikimedia.org/P100>">P100 
<https://phabricator.wikimedia.org/P100></a> already has label "test123" 
associated with language code en.'}}]; help:See http://localhost:8181/w/api.php 
for API usage. Subscribe to the mediawiki-api-announce mailing list at 
&lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for 
notice of API deprecations and breaking changes.]
  
  in the old case:
  
    messages = error.pop('messages', None)
  
  the error says:
  
  failed-save: The save has failed. [help:See http://localhost:8181/w/api.php 
for API usage. Subscribe to the mediawiki-api-announce mailing list at 
&lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for 
notice of API deprecations and breaking changes.]
  
  So the message is removed!!!!!!!!!!!!!!!!!!!!!! 
  Without message it is difficult to understand what happens and the message 
contains the entity that is clashing!
  
  The reason is that .pop removes the key "messages" from error 
(https://www.programiz.com/python-programming/methods/list/pop) while the new 
implementation does not.

TASK DETAIL
  https://phabricator.wikimedia.org/T235500

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: DD063520
Cc: Xqt, Aklapper, DD063520, pywikibot-bugs-list, Zkhalido, Jelabra, Viztor, 
DannyS712, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, _jensen, Altostratus, 
Avicennasis, Asahiko, mys_721tx, Wikidata-bugs, jayvdb, Ricordisamoa, Dalba, 
Masti, Alchimista, Addshore, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to