Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
75cf9b5a
Kaydet (Commit)
75cf9b5a
authored
Ara 31, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #13110 -- Removed SyndicationFeed.add_item()'s enclosure argument.
Per deprecation timeline.
üst
d67a46e1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
49 deletions
+8
-49
feedgenerator.py
django/utils/feedgenerator.py
+2
-15
syndication.txt
docs/ref/contrib/syndication.txt
+0
-8
utils.txt
docs/ref/utils.txt
+2
-9
2.0.txt
docs/releases/2.0.txt
+3
-0
tests.py
tests/syndication_tests/tests.py
+1
-17
No files found.
django/utils/feedgenerator.py
Dosyayı görüntüle @
75cf9b5a
...
...
@@ -24,10 +24,8 @@ http://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004/
from
__future__
import
unicode_literals
import
datetime
import
warnings
from
django.utils
import
datetime_safe
,
six
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.encoding
import
force_text
,
iri_to_uri
from
django.utils.six
import
StringIO
from
django.utils.six.moves.urllib.parse
import
urlparse
...
...
@@ -119,9 +117,8 @@ class SyndicationFeed(object):
def
add_item
(
self
,
title
,
link
,
description
,
author_email
=
None
,
author_name
=
None
,
author_link
=
None
,
pubdate
=
None
,
comments
=
None
,
unique_id
=
None
,
unique_id_is_permalink
=
None
,
enclosure
=
None
,
categories
=
(),
item_copyright
=
None
,
ttl
=
None
,
updateddate
=
None
,
enclosures
=
None
,
**
kwargs
):
unique_id
=
None
,
unique_id_is_permalink
=
None
,
categories
=
(),
item_copyright
=
None
,
ttl
=
None
,
updateddate
=
None
,
enclosures
=
None
,
**
kwargs
):
"""
Adds an item to the feed. All args are expected to be Python Unicode
objects except pubdate and updateddate, which are datetime.datetime
...
...
@@ -135,16 +132,6 @@ class SyndicationFeed(object):
if
ttl
is
not
None
:
# Force ints to unicode
ttl
=
force_text
(
ttl
)
if
enclosure
is
None
:
enclosures
=
[]
if
enclosures
is
None
else
enclosures
else
:
warnings
.
warn
(
"The enclosure keyword argument is deprecated, "
"use enclosures instead."
,
RemovedInDjango20Warning
,
stacklevel
=
2
,
)
enclosures
=
[
enclosure
]
item
=
{
'title'
:
to_unicode
(
title
),
'link'
:
iri_to_uri
(
link
),
...
...
docs/ref/contrib/syndication.txt
Dosyayı görüntüle @
75cf9b5a
...
...
@@ -963,7 +963,6 @@ They share this interface:
* ``pubdate``
* ``comments``
* ``unique_id``
* ``enclosure``
* ``enclosures``
* ``categories``
* ``item_copyright``
...
...
@@ -976,17 +975,10 @@ They share this interface:
* ``pubdate`` should be a Python :class:`~datetime.datetime` object.
* ``updateddate`` should be a Python :class:`~datetime.datetime` object.
* ``enclosure`` should be an instance of
:class:`django.utils.feedgenerator.Enclosure`.
* ``enclosures`` should be a list of
:class:`django.utils.feedgenerator.Enclosure` instances.
* ``categories`` should be a sequence of Unicode objects.
.. deprecated:: 1.9
The ``enclosure`` keyword argument is deprecated in favor of the
``enclosures`` keyword argument.
:meth:`.SyndicationFeed.write`
Outputs the feed in the given encoding to outfile, which is a file-like object.
...
...
docs/ref/utils.txt
Dosyayı görüntüle @
75cf9b5a
...
...
@@ -353,18 +353,11 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
All parameters should be Unicode objects, except ``categories``, which
should be a sequence of Unicode objects.
.. method:: add_item(title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None,
enclosure=None,
categories=(), item_copyright=None, ttl=None, updateddate=None, enclosures=None, **kwargs)
.. method:: add_item(title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, categories=(), item_copyright=None, ttl=None, updateddate=None, enclosures=None, **kwargs)
Adds an item to the feed. All args are expected to be Python ``unicode``
objects except ``pubdate`` and ``updateddate``, which are ``datetime.datetime``
objects, ``enclosure``, which is an ``Enclosure`` instance, and
``enclosures``, which is a list of ``Enclosure`` instances.
.. deprecated:: 1.9
The ``enclosure`` keyword argument is deprecated in favor of the
new ``enclosures`` keyword argument which accepts a list of
``Enclosure`` objects.
objects, and ``enclosures``, which is a list of ``Enclosure`` instances.
.. method:: num_items()
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
75cf9b5a
...
...
@@ -312,3 +312,6 @@ these features.
* Support for the ``allow_tags`` attribute on ``ModelAdmin`` methods is
removed.
* The ``enclosure`` keyword argument to ``SyndicationFeed.add_item()`` is
removed.
tests/syndication_tests/tests.py
Dosyayı görüntüle @
75cf9b5a
...
...
@@ -9,10 +9,7 @@ from django.core.exceptions import ImproperlyConfigured
from
django.test
import
TestCase
,
override_settings
from
django.test.utils
import
requires_tz_support
from
django.utils
import
timezone
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.feedgenerator
import
(
Enclosure
,
SyndicationFeed
,
rfc2822_date
,
rfc3339_date
,
)
from
django.utils.feedgenerator
import
rfc2822_date
,
rfc3339_date
from
.models
import
Article
,
Entry
...
...
@@ -520,16 +517,3 @@ class SyndicationFeedTest(FeedTestCase):
views
.
add_domain
(
'example.com'
,
'//example.com/foo/?arg=value'
),
'http://example.com/foo/?arg=value'
)
class
FeedgeneratorTestCase
(
TestCase
):
def
test_add_item_warns_when_enclosure_kwarg_is_used
(
self
):
feed
=
SyndicationFeed
(
title
=
'Example'
,
link
=
'http://example.com'
,
description
=
'Foo'
)
msg
=
'The enclosure keyword argument is deprecated, use enclosures instead.'
with
self
.
assertRaisesMessage
(
RemovedInDjango20Warning
,
msg
):
feed
.
add_item
(
title
=
'Example Item'
,
link
=
'https://example.com/item'
,
description
=
'bar'
,
enclosure
=
Enclosure
(
'http://example.com/favicon.ico'
,
0
,
'image/png'
),
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment