Consistent method naming
This patch renames the entries `pubdate` method to `pubDate` to be consistent with the feed's method as well as the documentation. Note that for now, the old method is preserved as well but is marked as deprecated and to be removed. This fixes #71
This commit is contained in:
parent
27e9cd0c9a
commit
7a053dc74c
2 changed files with 16 additions and 3 deletions
|
@ -12,6 +12,7 @@ from datetime import datetime
|
||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import dateutil.tz
|
import dateutil.tz
|
||||||
|
import warnings
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from feedgen.compat import string_types
|
from feedgen.compat import string_types
|
||||||
|
@ -569,13 +570,25 @@ class FeedEntry(object):
|
||||||
|
|
||||||
return self.__atom_published
|
return self.__atom_published
|
||||||
|
|
||||||
def pubdate(self, pubDate=None):
|
def pubDate(self, pubDate=None):
|
||||||
'''Get or set the pubDate of the entry which indicates when the entry
|
'''Get or set the pubDate of the entry which indicates when the entry
|
||||||
was published. This method is just another name for the published(...)
|
was published. This method is just another name for the published(...)
|
||||||
method.
|
method.
|
||||||
'''
|
'''
|
||||||
return self.published(pubDate)
|
return self.published(pubDate)
|
||||||
|
|
||||||
|
def pubdate(self, pubDate=None):
|
||||||
|
'''Get or set the pubDate of the entry which indicates when the entry
|
||||||
|
was published. This method is just another name for the published(...)
|
||||||
|
method.
|
||||||
|
|
||||||
|
pubdate(…) is deprected and may be removed in feedgen ≥ 0.8. Use
|
||||||
|
pubDate(…) instead.
|
||||||
|
'''
|
||||||
|
warnings.warn('pubdate(…) is deprected and may be removed in feedgen '
|
||||||
|
'≥ 0.8. Use pubDate(…) instead.')
|
||||||
|
return self.published(pubDate)
|
||||||
|
|
||||||
def rights(self, rights=None):
|
def rights(self, rights=None):
|
||||||
'''Get or set the rights value of the entry which conveys information
|
'''Get or set the rights value of the entry which conveys information
|
||||||
about rights, e.g. copyrights, held in and over the entry. This ATOM
|
about rights, e.g. copyrights, held in and over the entry. This ATOM
|
||||||
|
|
|
@ -87,8 +87,8 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
assert fe.summary() == 'asdf'
|
assert fe.summary() == 'asdf'
|
||||||
fe.description('asdfx')
|
fe.description('asdfx')
|
||||||
assert fe.description() == 'asdfx'
|
assert fe.description() == 'asdfx'
|
||||||
fe.pubdate('2017-02-05 13:26:58+01:00')
|
fe.pubDate('2017-02-05 13:26:58+01:00')
|
||||||
assert fe.pubdate().year == 2017
|
assert fe.pubDate().year == 2017
|
||||||
fe.rights('asdfx')
|
fe.rights('asdfx')
|
||||||
assert fe.rights() == 'asdfx'
|
assert fe.rights() == 'asdfx'
|
||||||
fe.comments('asdfx')
|
fe.comments('asdfx')
|
||||||
|
|
Loading…
Reference in a new issue