1 | from zope.interface import implements |
---|
2 | |
---|
3 | class ImageFTI(object): |
---|
4 | def _constructInstance(self, container, id, *args, **kw): |
---|
5 | """Build a bare instance of the appropriate type. |
---|
6 | Does not do any security checks. |
---|
7 | Returns the object without calling _finishConstruction(). |
---|
8 | """ |
---|
9 | file, title = None, '' |
---|
10 | id = container.manage_addProduct['OFSP'].manage_addImage(id, file, title) |
---|
11 | return container.get(id, None) |
---|
12 | |
---|
13 | def _finishConstruction(self, obj): |
---|
14 | """Finish the construction of a content object. |
---|
15 | Set its portal_type, insert it into the workflows. |
---|
16 | """ |
---|
17 | return obj |
---|
18 | |
---|
19 | ImageFTIUtility = ImageFTI() |
---|
20 | |
---|
21 | class FileFTI(object): |
---|
22 | def _constructInstance(self, container, id, *args, **kw): |
---|
23 | """Build a bare instance of the appropriate type. |
---|
24 | Does not do any security checks. |
---|
25 | Returns the object without calling _finishConstruction(). |
---|
26 | """ |
---|
27 | file, title = None, '' |
---|
28 | id = container.manage_addProduct['OFSP'].manage_addFile(id, file, title) |
---|
29 | return container.get(id, None) |
---|
30 | |
---|
31 | def _finishConstruction(self, obj): |
---|
32 | """Finish the construction of a content object. |
---|
33 | Set its portal_type, insert it into the workflows. |
---|
34 | """ |
---|
35 | return obj |
---|
36 | |
---|
37 | FileFTIUtility = FileFTI() |
---|