Skip to content

Commit 4dca747

Browse files
author
Steve Canny
committed
part_fctry: change CustomPartClass contruct to load()
Use a classmethod constructor (.load()) for CustomPartClass rather than constructing directly. This allows custom part class to do some pre-processing before actual construction, and keeping its __init__() method clean, containing only simple assignments to state vars.
1 parent d7c43e6 commit 4dca747

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opc/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class PartFactory(object):
172172
def __new__(cls, partname, content_type, blob):
173173
if content_type in PartFactory.part_type_for:
174174
CustomPartClass = PartFactory.part_type_for[content_type]
175-
return CustomPartClass(partname, content_type, blob)
175+
return CustomPartClass.load(partname, content_type, blob)
176176
return Part(partname, content_type, blob)
177177

178178

0 commit comments

Comments
 (0)