Commit f05aab2a authored by Lucas Carvalho's avatar Lucas Carvalho

portal contributions does the same and much more, so we must use it.

parent bb106904
......@@ -65,7 +65,6 @@ def WebSection_setObject(self, id, ob, **kw):
Add any change of the file uploaded.
sha512sum = hashlib.sha512()
while True:
......@@ -93,26 +92,9 @@ def WebSection_putFactory(self, name, typ, body):
The key is the file name.
portal = self.getPortalObject()
group = ('networkcache',)
new_id = str(portal.portal_ids.generateNewId(id_group=group))
registry = portal.portal_contribution_registry
portal_type = registry.findPortalTypeName(filename=name,
if portal_type is None:
return None
# The code bellow is inspired from ERP5Type.Core.Folder.newContent
pt = self._getTypesTool()
myType = pt.getTypeInfo(self)
if myType is not None and not myType.allowType( portal_type ) and \
'portal_contributions' not in self.getPhysicalPath():
raise ValueError('Disallowed subobject type: %s' % portal_type)
container = portal.getDefaultModule(portal_type)
document = container._getOb(new_id)
document = portal.portal_contributions.newContent(data=body,
# We can only change the state of the object after all the activities and
# interaction workflow, to avoid any security problem.
\ No newline at end of file
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment