Coverage for gramex\handlers\pptxhandler.py: 100%

# Coverage for gramex\handlers\pptxhandler.py : 100%

## 13 statements 13 run 0 missing 0 excluded 0 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 import io

2 from gramex.handlers import BaseHandler

3

4 _mime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'

5

6

7 class PPTXHandler(BaseHandler):

8 def get(self):

9 # pptgen is not required unless PPTXHandler is used

10 from gramex.pptgen import pptgen # noqa

11

12 target = io.BytesIO()

13 pptgen(target=target, handler=self, **self.kwargs)

14

15 # Set up headers

16 headers = self.kwargs.get('headers', {})

17 headers.setdefault('Content-Type', _mime)

18 for key, val in headers.items():

19 self.set_header(key, val)

20

21 self.write(target.getvalue())