reference-feed-rights_detail.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .. _reference.feed.rights_detail:
  2. :py:attr:`feed.rights_detail`
  3. =============================
  4. A dictionary with details on the feed copyright.
  5. .. _reference.feed.rights_detail.value:
  6. :py:attr:`feed.rights_detail.value`
  7. -----------------------------------
  8. Same as :ref:`reference.feed.rights`.
  9. If this contains :abbr:`HTML (HyperText Markup Language)` or :abbr:`XHTML
  10. (Extensible HyperText Markup Language)`, it is :ref:`sanitized
  11. <advanced.sanitization>` by default.
  12. If this contains :abbr:`HTML (HyperText Markup Language)` or :abbr:`XHTML
  13. (Extensible HyperText Markup Language)`, certain (X)HTML elements within this
  14. value may contain relative :abbr:`URI (Uniform Resource Identifier)`s. If so,
  15. they are :ref:`resolved according to a set of rules <advanced.base>`.
  16. .. _reference.feed.rights_detail.type:
  17. :py:attr:`feed.rights_detail.type`
  18. ----------------------------------
  19. The content type of the feed copyright.
  20. Most likely values for :py:attr:`~feed.rights_detail.type`:
  21. * :mimetype:`text/plain`
  22. * :mimetype:`text/html`
  23. * :mimetype:`application/xhtml+xml`
  24. For Atom feeds, the content type is taken from the type attribute, which
  25. defaults to :mimetype:`text/plain` if not specified. For :abbr:`RSS (Rich Site
  26. Summary)` feeds, the content type is auto-determined by inspecting the content,
  27. and defaults to :mimetype:`text/html`. Note that this may cause silent data
  28. loss if the value contains plain text with angle brackets. There is nothing I
  29. can do about this problem; it is a limitation of :abbr:`RSS (Rich Site
  30. Summary)`.
  31. Future enhancement: some versions of :abbr:`RSS (Rich Site Summary)` clearly
  32. specify that certain values default to :mimetype:`text/plain`, and
  33. :program:`Universal Feed Parser` should respect this, but it doesn't yet.
  34. :py:attr:`feed.rights_detail.language`
  35. --------------------------------------
  36. The language of the feed copyright.
  37. :py:attr:`~feed.rights_detail.language` is supposed to be a language code, as
  38. specified by `:abbr:`RFC (Request For Comments)` 3066
  39. <http://www.ietf.org/rfc/rfc3066.txt>`_, but publishers have been known to
  40. publish random values like "English" or "German". :program:`Universal Feed
  41. Parser` does not do any parsing or normalization of language codes.
  42. :py:attr:`~feed.rights_detail.language` may come from the element's xml:lang
  43. attribute, or it may inherit from a parent element's xml:lang, or the
  44. Content-Language :abbr:`HTTP (Hypertext Transfer Protocol)` header. If the
  45. feed does not specify a language, :py:attr:`~feed.rights_detail.language` will
  46. be ``None``, the :program:`Python` null value.
  47. :py:attr:`feed.rights_detail.base`
  48. ----------------------------------
  49. The original base :abbr:`URI (Uniform Resource Identifier)` for links within
  50. the feed copyright.
  51. :py:attr:`~feed.rights_detail.base` is only useful in rare situations and can
  52. usually be ignored. It is the original base :abbr:`URI (Uniform Resource
  53. Identifier)` for this value, as specified by the element's xml:base attribute,
  54. or a parent element's xml:base, or the appropriate :abbr:`HTTP (Hypertext
  55. Transfer Protocol)` header, or the :abbr:`URI (Uniform Resource Identifier)` of
  56. the feed. (See :ref:`advanced.base` for more details.) By the time you see
  57. it, :program:`Universal Feed Parser` has already resolved relative links in all
  58. values where it makes sense to do so. *Clients should never need to manually
  59. resolve relative links.*
  60. .. rubric:: Comes from
  61. * /atom03:feed/atom03:copyright
  62. * /atom10:feed/atom10:rights
  63. * /rdf:RDF/rdf:channel/dc:rights
  64. * /rss/channel/copyright
  65. * /rss/channel/dc:rights
  66. .. seealso::
  67. * :ref:`reference.feed.rights`