https://bugzilla.wikimedia.org/show_bug.cgi?id=55149
--- Comment #13 from Kunal Mehta (Legoktm) <[email protected]> --- There are two ways doing that task creating an item; i'll explain it with a pseudocode: 1st: repo = repository\(localpage\) try: repo.createitem\(\) except itemExistError: print repo.title\(\), 'already exist' 2st: repo = repository\(localpage\) if not repo.exists\(\): repo.createitem\(\) else: print repo.title\(\), 'allready exits' I prefer the last one. Look at this sample: >>> import wikipedia as wp >>> p = wp.Page\('de', 'Helium'\) >>> d = wp.DataPage\(p\) >>> d DataPage\{\[\[wikidata:None\]\]\} >>> d.exists\(\) True >>> d DataPage\{\[\[wikidata:Q560\]\]\} >>> This means you does not need to call DataPage.get\(\) you may also use DataPage.exists\(\) for this test. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
