Show More
@@ -65,16 +65,12 b' class ExtractOutputTransformer(Transformer):' | |||
|
65 | 65 | |
|
66 | 66 | #Get the output in data formats that the template is interested in. |
|
67 | 67 | for out_type in self.display_data_priority: |
|
68 | ||
|
69 | # Only extract the output if it's data exists as an attribute. | |
|
70 | # This means things like output_type="stream" where the data | |
|
71 | # is stored in "text" (instead of "stream"), will not be | |
|
72 | # extracted (intentional). | |
|
73 | 68 | if out.hasattr(out_type): |
|
74 | 69 | data = out[out_type] |
|
75 | 70 | |
|
76 | 71 | #Binary files are base64-encoded, SVG is already XML |
|
77 | 72 | if out_type in ('png', 'jpg', 'jpeg', 'pdf'): |
|
73 | ||
|
78 | 74 | # data is b64-encoded as text (str, unicode) |
|
79 | 75 | # decodestring only accepts bytes |
|
80 | 76 | data = py3compat.cast_bytes(data) |
General Comments 0
You need to be logged in to leave comments.
Login now