summaryrefslogtreecommitdiff
path: root/apidocs/testtools.content.Content.html
blob: 0cc8cdec23729d9532d10c9df2c5ccf7cadc5cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          "DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>testtools.content.Content : API documentation</title>

    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <link href="bootstrap.min.css" type="text/css" rel="stylesheet" />
    <link href="apidocs.css" type="text/css" rel="stylesheet" />
  </head>
  <body>

    <nav class="navbar navbar-default">
      <div class="container">
        <div class="navbar-header">
          <a href="index.html" class="navbar-brand">
            <a href="https://github.com/testing-cabal/testtools">testtools</a> API Documentation
          </a>
        </div>
      </div>
    </nav>

    <div class="container">

      <div class="page-header">
        <h1 class="class"><code>testtools.content.Content(<span title="object">object</span>)</code> <small>class documentation</small></h1>

        <span id="partOf">
          Part of <code><a href="testtools.html" class="code">testtools</a>.<a href="testtools.content.html" class="code">content</a></code>
          
          <a href="classIndex.html#testtools.content.Content">(View In Hierarchy)</a>
        </span>
      </div>

      <div class="extrasDocstring">
        <p>Known subclasses: <a href="testtools.content.StackLinesContent.html" class="code">testtools.content.StackLinesContent</a>, <a href="testtools.content.TracebackContent.html" class="code">testtools.content.TracebackContent</a></p>
      </div>

      <div class="moduleDocstring">
        <div><p>A MIME-like Content object.</p>
<p>'Content' objects can be serialised to bytes using the iter_bytes method.
If the 'Content-Type' is recognised by other code, they are welcome to
look for richer contents that mere byte serialisation - for example in
memory object graphs etc. However, such code MUST be prepared to receive
a generic 'Content' object that has been reconstructed from a byte stream.</p><table class="fieldTable"></table></div>
      </div>

      <div id="splitTables">
        <table class="children sortable" id="id141">
  
  <tr class="instancevariable">
    
    <td>Instance Variable</td>
    <td><a href="testtools.content.Content.html#content_type" class="code">content_type</a></td>
    <td>The content type of this Content.</td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#__init__" class="code">__init__</a></td>
    <td><span>Create a ContentType.</span></td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#__eq__" class="code">__eq__</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#as_text" class="code">as_text</a></td>
    <td><span>Return all of the content as text.</span></td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#iter_bytes" class="code">iter_bytes</a></td>
    <td><span>Iterate over bytestrings of the serialised content.</span></td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#iter_text" class="code">iter_text</a></td>
    <td><span>Iterate over the text of the serialised content.</span></td>
  </tr><tr class="method">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#__repr__" class="code">__repr__</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="method private">
    
    <td>Method</td>
    <td><a href="testtools.content.Content.html#_iter_text" class="code">_iter_text</a></td>
    <td><span>Worker for iter_text - does the decoding.</span></td>
  </tr>
</table>
        

          
      </div>

      <div id="childList">

        <div class="function">
  <a name="testtools.content.Content.content_type">
    
  </a>
  <a name="content_type">
    
  </a>
  <div class="functionHeader">
    content_type =
  </div>
  <div class="functionBody">
    The content type of this Content.
  </div>
</div><div class="function">
  <a name="testtools.content.Content.__init__">
    
  </a>
  <a name="__init__">
    
  </a>
  <div class="functionHeader">
    
    def
    __init__(self, content_type, get_bytes):
    
  </div>
  <div class="docstring functionBody">
    <div class="interfaceinfo">overridden in <a href="testtools.content.StackLinesContent.html" class="code">testtools.content.StackLinesContent</a>, <a href="testtools.content.TracebackContent.html" class="code">testtools.content.TracebackContent</a></div>
    <div>Create a ContentType.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content.__eq__">
    
  </a>
  <a name="__eq__">
    
  </a>
  <div class="functionHeader">
    
    def
    __eq__(self, other):
    
  </div>
  <div class="docstring functionBody">
    
    <div class="undocumented">Undocumented</div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content.as_text">
    
  </a>
  <a name="as_text">
    
  </a>
  <div class="functionHeader">
    
    def
    as_text(self):
    
  </div>
  <div class="docstring functionBody">
    
    <div><p>Return all of the content as text.</p>
<p>This is only valid where <tt class="rst-docutils literal">iter_text</tt> is.  It will load all of the
content into memory.  Where this is a concern, use <tt class="rst-docutils literal">iter_text</tt>
instead.</p><table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content.iter_bytes">
    
  </a>
  <a name="iter_bytes">
    
  </a>
  <div class="functionHeader">
    
    def
    iter_bytes(self):
    
  </div>
  <div class="docstring functionBody">
    
    <div>Iterate over bytestrings of the serialised content.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content.iter_text">
    
  </a>
  <a name="iter_text">
    
  </a>
  <div class="functionHeader">
    
    def
    iter_text(self):
    
  </div>
  <div class="docstring functionBody">
    
    <div><p>Iterate over the text of the serialised content.</p>
<p>This is only valid for text MIME types, and will use ISO-8859-1 if
no charset parameter is present in the MIME type. (This is somewhat
arbitrary, but consistent with RFC2617 3.7.1).</p><table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Raises</td><td class="fieldArg">ValueError</td><td>If the content type is not text/*.</td></tr></table></div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content._iter_text">
    
  </a>
  <a name="_iter_text">
    
  </a>
  <div class="functionHeader">
    
    def
    _iter_text(self):
    
  </div>
  <div class="docstring functionBody">
    
    <div>Worker for iter_text - does the decoding.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="testtools.content.Content.__repr__">
    
  </a>
  <a name="__repr__">
    
  </a>
  <div class="functionHeader">
    
    def
    __repr__(self):
    
  </div>
  <div class="docstring functionBody">
    
    <div class="undocumented">Undocumented</div>
  </div>
</div>

      </div>
      <address>
        <a href="index.html">API Documentation</a> for <a href="https://github.com/testing-cabal/testtools">testtools</a>, generated by <a href="https://github.com/twisted/pydoctor/">pydoctor</a> at 2015-07-01 16:11:28.
      </address>

    </div>
  </body>
</html>