Skip to content

Commit

Permalink
Merge "[DOC] Improve deprecation warnings"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Sep 2, 2017
2 parents a17a89e + 1ff411c commit 0ec8132
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pywikibot/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -7352,8 +7352,26 @@ def __getattr__(self, attr):
props = attr.replace("get_", "")
if props in ['info', 'sitelinks', 'aliases', 'labels',
'descriptions', 'urls']:
if props == 'info':
instead = (
'\n'
"{'lastrevid': WikibasePage.latest_revision_id,\n"
" 'pageid': WikibasePage.pageid,\n"
" 'title': WikibasePage.title(),\n"
" 'modified': WikibasePage._timestamp,\n"
" 'ns': WikibasePage.namespace(),\n"
" 'type': WikibasePage.entity_type, # for subclasses\n"
" 'id': WikibasePage.id"
'}\n')
elif props == 'sitelinks':
instead = 'ItemPage.sitelinks'
elif props in ('aliases', 'labels', 'descriptions'):
instead = ('WikibasePage.{0} after WikibasePage.get()'
.format(attr))
else: # urls
instead = None
issue_deprecation_warning('DataSite.{0}()'.format(attr),
'WikibasePage', 2)
instead, 2)
if props == 'urls':
props = 'sitelinks/urls'
method = self._get_propertyitem
Expand Down

0 comments on commit 0ec8132

Please sign in to comment.