Commit d9a13e56c8348b93f15980e139c9d28af673670f

Authored by Christian Herdtweck
1 parent b3c584b2

ooxml: Mention other file-like classes in ZipSubFile

Also: 2 minor changes
Showing 1 changed file with 15 additions and 3 deletions
oletools/ooxml.py
... ... @@ -95,11 +95,11 @@ def get_type(filename):
95 95 logging.debug(u' ' + debug_str(elem))
96 96 try:
97 97 is_xls |= elem.attrib['ContentType'].startswith(
98   - CONTENT_TYPES_EXCEL)
  98 + CONTENT_TYPES_EXCEL)
99 99 is_doc |= elem.attrib['ContentType'].startswith(
100   - CONTENT_TYPES_WORD)
  100 + CONTENT_TYPES_WORD)
101 101 is_ppt |= elem.attrib['ContentType'].startswith(
102   - CONTENT_TYPES_PPT)
  102 + CONTENT_TYPES_PPT)
103 103 except KeyError: # ContentType not an attr
104 104 pass
105 105  
... ... @@ -153,6 +153,9 @@ class ZipSubFile(object):
153 153 handle: direct handle to subfile stream, created by ZipFile.open()
154 154 pos: current position within stream (can deviate from actual position in
155 155 self.handle if we fake jump to end)
  156 +
  157 + See also (and maybe could some day merge with):
  158 + ppt_record_parser.IterStream; also: oleobj.FakeFile
156 159 """
157 160  
158 161 def __init__(self, container, filename, mode='r', size=None):
... ... @@ -172,6 +175,15 @@ class ZipSubFile(object):
172 175 self.pos = None
173 176 self.closed = True
174 177  
  178 + def readable(self):
  179 + return True
  180 +
  181 + def writable(self):
  182 + return False
  183 +
  184 + def seekable(self):
  185 + return True
  186 +
175 187 def open(self):
176 188 """ open subfile for reading; open mode given to constructor before """
177 189 if self.handle is not None:
... ...