Nemo_bis created this task. Nemo_bis added a subscriber: Nemo_bis. Nemo_bis added a project: Pywikibot-Wikidata. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION When I do something like ``` item = ItemPage(self.repo, '-1') item.editLabels({uselang: title}) item.addClaim(claim, bot=True) ``` (just assume the variables are defined, see https://gerrit.wikimedia.org/r/#/c/166629/14 for context), I get:
``` site.py", line 5629, in addClaim if claims in item and claim.getID() in item.claims: NameError: global name 'claims' is not defined <type 'exceptions.NameError'> ```
Shouldn't that if check for existence of "item.claims"?
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Nemo_bis Cc: pywikipedia-bugs, Nemo_bis, Aklapper
Nemo_bis added a project: pywikibot-core. Nemo_bis set Security to None.
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Nemo_bis Cc: pywikipedia-bugs, Nemo_bis, Aklapper, jayvdb
XZise added a subscriber: XZise. XZise added a comment.
Hmm I couldn't find such a line in addClaims. And that if has also an else branch, so it would also need an elif.
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise Cc: XZise, Nemo_bis, Aklapper, jayvdb, pywikipedia-bugs
Nemo_bis edited the task description.
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Nemo_bis Cc: XZise, Nemo_bis, Aklapper, jayvdb, pywikipedia-bugs
Nemo_bis added a comment.
Sorry, past error.
In my testing I just made it
# Update the item try: if claim.getID() in item.claims: item.claims[claim.getID()].append(claim) else: item.claims[claim.getID()] = [claim] except AttributeError: # claims were not defined pass
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Nemo_bis Cc: XZise, Nemo_bis, Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a subscriber: gerritbot. gerritbot added a comment.
Change 201876 had a related patch set uploaded (by John Vandenberg): Instantiate empty ItemPage with empty attributes
https://gerrit.wikimedia.org/r/201876
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: gerritbot Cc: gerritbot, XZise, Nemo_bis, Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review.
TASK DETAIL https://phabricator.wikimedia.org/T94848
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: gerritbot Cc: gerritbot, XZise, Nemo_bis, Aklapper, jayvdb, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org