Show More
@@ -65,16 +65,12 b' class ExtractOutputTransformer(Transformer):' | |||||
65 |
|
65 | |||
66 | #Get the output in data formats that the template is interested in. |
|
66 | #Get the output in data formats that the template is interested in. | |
67 | for out_type in self.display_data_priority: |
|
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 | if out.hasattr(out_type): |
|
68 | if out.hasattr(out_type): | |
74 | data = out[out_type] |
|
69 | data = out[out_type] | |
75 |
|
70 | |||
76 | #Binary files are base64-encoded, SVG is already XML |
|
71 | #Binary files are base64-encoded, SVG is already XML | |
77 | if out_type in ('png', 'jpg', 'jpeg', 'pdf'): |
|
72 | if out_type in ('png', 'jpg', 'jpeg', 'pdf'): | |
|
73 | ||||
78 | # data is b64-encoded as text (str, unicode) |
|
74 | # data is b64-encoded as text (str, unicode) | |
79 | # decodestring only accepts bytes |
|
75 | # decodestring only accepts bytes | |
80 | data = py3compat.cast_bytes(data) |
|
76 | data = py3compat.cast_bytes(data) |
General Comments 0
You need to be logged in to leave comments.
Login now