Commits

Nicolas Grilly  committed 807c92a

Remove class method Part.from_fp and directly call the constructor instead

  • Participants
  • Parent commits 6a3c394

Comments (0)

Files changed (1)

File cherrypy/_cpreqbody.py

     
     # Read all parts
     while True:
-        part = entity.part_class.from_fp(entity.fp, ib)
+        part = entity.part_class(entity.fp, ib)
         entity.parts.append(part)
         part.process()
         if part.fp.done:
     Python's standard library.
     """
     
-    def __init__(self, fp, headers, boundary):
+    def __init__(self, fp, boundary):
+        headers = self._read_headers(fp)
         Entity.__init__(self, fp, headers)
         self.boundary = boundary
         self.file = None
         self.value = None
     
-    def from_fp(cls, fp, boundary):
+    def _read_headers(self, fp):
         headers = httputil.HeaderMap()
         
         while True:
                 v = ", ".join((existing, v))
             headers[k] = v
         
-        return cls(fp, headers, boundary)
-    from_fp = classmethod(from_fp)
+        return headers
     
     def read_lines_to_boundary(self, fp_out=None):
         """Read bytes from self.fp and return or write them to a file.