MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/utils/feedgenerator.py:113–163  ·  view source on GitHub ↗
(
        self,
        title,
        link,
        description,
        language=None,
        author_email=None,
        author_name=None,
        author_link=None,
        subtitle=None,
        categories=None,
        feed_url=None,
        feed_copyright=None,
        feed_guid=None,
        ttl=None,
        stylesheets=None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

111 "Base class for all syndication feeds. Subclasses should provide write()"
112
113 def __init__(
114 self,
115 title,
116 link,
117 description,
118 language=None,
119 author_email=None,
120 author_name=None,
121 author_link=None,
122 subtitle=None,
123 categories=None,
124 feed_url=None,
125 feed_copyright=None,
126 feed_guid=None,
127 ttl=None,
128 stylesheets=None,
129 **kwargs,
130 ):
131 def to_str(s):
132 return str(s) if s is not None else s
133
134 def to_stylesheet(s):
135 return s if isinstance(s, Stylesheet) else Stylesheet(s)
136
137 categories = categories and [str(c) for c in categories]
138
139 if stylesheets is not None:
140 if isinstance(stylesheets, (Stylesheet, str)):
141 raise TypeError(
142 f"stylesheets should be a list, not {stylesheets.__class__}"
143 )
144 stylesheets = [to_stylesheet(s) for s in stylesheets]
145
146 self.feed = {
147 "title": to_str(title),
148 "link": iri_to_uri(link),
149 "description": to_str(description),
150 "language": to_str(language),
151 "author_email": to_str(author_email),
152 "author_name": to_str(author_name),
153 "author_link": iri_to_uri(author_link),
154 "subtitle": to_str(subtitle),
155 "categories": categories or (),
156 "feed_url": iri_to_uri(feed_url),
157 "feed_copyright": to_str(feed_copyright),
158 "id": feed_guid or link,
159 "ttl": to_str(ttl),
160 "stylesheets": stylesheets,
161 **kwargs,
162 }
163 self.items = []
164
165 def add_item(
166 self,

Callers

nothing calls this directly

Calls 1

iri_to_uriFunction · 0.90

Tested by

no test coverage detected