nausheenfatma / python-wikitools

Automatically exported from code.google.com/p/python-wikitools
0 stars 0 forks source link

Cannot create new article from api. #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I log into site then try to create article using the following code
newarticle = page.Page(site,title="Sandbox Test")
newarticle.edit(title="Sandbox Test",text="This is some text 
text",createonly=True,summary="test summary for use of api to create pages")

What is the expected output? What do you see instead?
On one test site (MW 1.14) The new page is created first time as "api.php" (a 
wiki page). I can't force it to accept my title.

On another site it tells me I have an edit rather than create token:

[u'read', u'createpage', u'createtalk', u'writeapi', u'ns104_read', 
u'ns105_read', u'ns105_edit', u'ns105_create', u'ns106_read', u'ns108_read']
Sandbox Test
Traceback (most recent call last):
  File "D:\Documents\PythonScripts\wikitools\ForumNokia\PageDownloader\createpage.py", line 73, in <module>
    newarticle.edit(title="Sandbox Test",text="This is some text text",createonly=True,summary="test summary for use of api to create pages")
  File "C:\Python25\lib\site-packages\wikitools\page.py", line 520, in edit
    token = self.getToken('edit')
  File "C:\Python25\lib\site-packages\wikitools\page.py", line 713, in getToken
    token = response['query']['pages'][str(self.pageid)][type+'token']
KeyError: 'edittoken'

What version of the product are you using? On what operating system?

I'm using windows. I'm not sure which version of wiki tools. Expect that it was 
gathered mid year though.

Please provide any additional information below.

Original issue reported on code.google.com by hami...@symbian.org on 16 Dec 2010 at 3:41

GoogleCodeExporter commented 8 years ago
I can't reproduce this. For the MW 1.14 wiki, that sounds like a bug in 
MediaWiki or an issue with the setup, 
https://bugzilla.wikimedia.org/show_bug.cgi?id=22969 might be related. I can't 
think of anything in wikitools that could possibly cause that.

For the latter, there's no such thing as a create token. If the list shown 
before the error is the list of rights your user account has, the problem is 
that you need the 'edit' right. AFAIK, 'create' doesn't work without 'edit'

Original comment by MrZmanwiki@gmail.com on 20 Dec 2010 at 4:32

GoogleCodeExporter commented 8 years ago
You're right. This was a site issue. Thank you.

Original comment by hamishwi...@gmail.com on 7 Apr 2011 at 11:58

GoogleCodeExporter commented 8 years ago

Original comment by MrZmanwiki@gmail.com on 8 Jun 2011 at 11:05