Bugs item #3605830, was opened at 2013-02-24 11:21
Message generated for change (Comment added) made by reza1615
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605830&group_id=93107

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: reza  (reza1615)
Assigned to: Nobody/Anonymous (nobody)
Summary: setitem for wikidata doesn't work!

Initial Comment:
I used this code

#!/usr/bin/python
# -*- coding: utf-8 -*-
import wikipedia,login
summary=u'آبشار لاتون,آبشار لاتون'

site=wikipedia.getSite('fa',fam='wikipedia')
fapage=wikipedia.Page(site,u'آبشار_لاتون')
data=wikipedia.DataPage(fapage)

list=data.get()
id=list['entity'].replace('q','')
data = wikipedia.DataPage(site.data_repository(), "Q"+id)

data.setitem(summary,items={'type': u'item', 'label': 'glk', 
'value':u'آبشار_لاتون'})
data.setitem(summary,items={'type': u'sitelink', 'site': 'glk', 
'title':u'آبشار_لاتون_(بارزاو)'})

it shows
Updating page [[wikidata:Q5058182]] via API
Updating page [[wikidata:Q5058182]] via API

but it doesn't update the page!
also please add 

def getIdFromPage(data)
        id=data.get() ['entity'].replace('q','')
        return id

and add 

data = DataPage(site.data_repository(), "Q"+id)

to first line of setitem() 



----------------------------------------------------------------------

>Comment By: reza  (reza1615)
Date: 2013-02-25 02:35

Message:
three :)

----------------------------------------------------------------------

Comment By: reza  (reza1615)
Date: 2013-02-25 02:34

Message:
Thank you now it works.
please add these tree lines to setitem() 

list=data.get()
id=list['entity'].replace('q','')
data = wikipedia.DataPage(site.data_repository(), "Q"+id)

now we should write these tree lines for every DataPage()


----------------------------------------------------------------------

Comment By: Amir  (amird)
Date: 2013-02-24 21:58

Message:
fixed in r11114
http://www.wikidata.org/w/index.php?title=Q5058182&diff=prev&oldid=7673026
http://www.wikidata.org/w/index.php?title=Q5058182&diff=prev&oldid=7673011

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605830&group_id=93107

_______________________________________________
Pywikipedia-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-bugs

Reply via email to